Re: reading a file line by line

2002-03-04 Thread Hernan Freschi
There's a simpler way, if you specify the file from the command line (as in script.pl file) you can do while (<>) { last if /search test/; #do something } in fact, you can make a cat-like script like this: while (<>) { print; } <> is the diamond operator, and it's the filehandle fo

Re: reading a file line by line

2002-02-27 Thread John W. Krahn
Jon Serra wrote: > > 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 > this: > > chomp (@line = `cat filename`); > > I do not want to do this beacuse my file is quite large, and there

RE: reading a file line by line

2002-02-27 Thread Lyon, Justin
#x27;s it. Somebody correct me if I'm wrong. -Original Message- From: Jon Serra [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 27, 2002 11:58 AM To: [EMAIL PROTECTED] Subject: reading a file line by line Greetings, I am trying to read a text file into a scalar variable lin

Re: reading a file line by line

2002-02-27 Thread Brett W. McCoy
On Wed, 27 Feb 2002, Jon Serra wrote: > 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 > this: > > chomp (@line = `cat filename`); > > I do not want to do this beacuse my file is quite

reading a file line by line

2002-02-27 Thread Jon Serra
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 this: 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