On Mar 7, 2006, at 12:33, 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??
Can you send the part that is actually _reading_ from FILE? Are the
contents of 'file' compressed?
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???
I'd say the most transparent solution is the PerlIO layer PerlIO::gzip:
http://search.cpan.org/~nwclark/PerlIO-gzip/gzip.pm
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>