read line by line in perl 
Author Message
 read line by line in perl

How can I read a text file line by line in perl
read line one, dosomethoing read line 2 the do something and read line
three do something..

EX:

info>>this|is|some|info|
more>>thhis|is|more|info
more>>this|is|more|again
end>>this|is|the|end

The second line can appear many times, so I need to read the first
line and put that data into a scalar, then I need to reAZd the second
line, if the beggining of it starts with more>> then I will act
acordinagly. Then eventually the last line will be read and so
forth....

Giga



Tue, 10 Jul 2001 03:00:00 GMT  
 read line by line in perl

+ How can I read a text file line by line in perl
+ read line one, dosomethoing read line 2 the do something and read line
+ three do something..

while not eof do begin
   read file line
   DoSomethingTo line
endwhile

In your case, I'll suggest 'Learning Perl', 2nd edition. Its blue, has
a llama on the cover. Then you can discover how to code the previous
pseudo-code into valid perl...

Or you can just simply read the documentation that came with your
distribution, if you don't want to spend $30 for a book.

James - actually, perl combines the read with the while statement, so its
        a bit shorter than the pseudo-code



Tue, 10 Jul 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. read last line without reading previous lines, how?

2. How do I read line by line of data from a file using perl

3. newbie perl question - reading a file line by line

4. how to read in line by line?

5. read line by line

6. Limiting maximum line length during line based read

7. how to read in line by line?

8. how to read a huge file line by line without loading it into memory

9. reading lines from one file and pulling matching lines in another

10. Line by line file reading

11. How to read a file line by line w/loop

12. Read remote text file line by line

 

 
Powered by phpBB® Forum Software