Saurabh Singhvi wrote:
Hi

#!/usr/bin/perl

open(FILE,'file') or die "Couldn't open $!";
while (1){
        ..
        ...
         }
}

This is a sample code i am using to read a file
Now the issue here is that the complete file gets loaded into memory at once
and then the
following job of parsing gets done. Is there a way i can just load a single
line one at a time??

Also if the file(text contents) is a compressed file, which can be viewed
with 'less' and catted by 'zcat' and uncompressed
by 'uncompress' in linux, what's the best way to uncompress it on the fly???

At the moment i am  uncompressing all of them. But i just want to know if i
can do it by this method.

Thanks
Saurabh

try:
while (<>) {...}

and:
open (FH, "gunzip -cd $filename |");

regards.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to