develooper Front page | perl.beginners | Postings from February 2002

reading a file line by line

Thread Next
Jon Serra
February 27, 2002 12:01
reading a file line by line
Message ID:
Greetings,  I am trying to read a text file into a scalar variable line by line 
until EOF or a search test if fullfilled.  I have been reading files in like 

chomp (@line = `cat filename`);

I do not want to do this beacuse my file is quite large, and there is no reason 
to hog the memory for the little bit I actually want, and second, I do not want 
to make a system call to the unix cat command.  TIA Jon

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About