Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > Re: opening a b...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 10882 of 12002
Post > Topic >>

Re: opening a big file

by rich.japh@[EMAIL PROTECTED] (Richard Lee) Apr 6, 2008 at 10:38 PM

Richard Lee wrote:
> I am trying to open a big file and go through line by line while 
> limiting the resource on the system.
> What is the best way to do it?
>
> Does below read the entire file and store them in memory(not good if 
> that's the case)..
>
> open(SOURCE, "/tmp/file") || die "not there: $!\n";
> while (<SOURCE>) {
> ## do something
> }
>
> sometime ago I saw somewhere it had something like below which look 
> like it was reading them and going through line by line without 
> storing them all in memory.
> I just cannot remember the syntax exactly.
>
> open(SOURCE, " /tmp/file |") || die "not there: $!\n";
> while (<>) {
> ## do something
>
> }
>
>
reposting without php-generals lists.. cc'd them by mistake.
 




 1 Posts in Topic:
Re: opening a big file
rich.japh@[EMAIL PROTECTE  2008-04-06 22:38:37 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 9:52:11 CDT 2008.