Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Read Line And Selected Subsequent Lines

Reply
Thread Tools

Read Line And Selected Subsequent Lines

 
 
sc0ri0n
Guest
Posts: n/a
 
      05-13-2004
I was looking for this and I saw Perl Gurl's code in
http://www.purlgurl.net/~purlgurl/perl/file/read_1.html

I've 2 questions ...

1-) why does "$line_1 = ;" work and print the next line?

2-) Is it possible to go back and read the previous 3 lines too?

Thanks,

Pete


 
Reply With Quote
 
 
 
 
Bob Walton
Guest
Posts: n/a
 
      05-13-2004
sc0ri0n wrote:

> I was looking for this and I saw Perl Gurl's code in
> http://www.purlgurl.net/~purlgurl/perl/file/read_1.html
>
> I've 2 questions ...
>
> 1-) why does "$line_1 = ;" work and print the next line?



That's because that's not what the line really says. Check out the HTML
source and see why you should ignore crap from PG (it forgot to quote
its source code when it made HTML out of it).


>
> 2-) Is it possible to go back and read the previous 3 lines too?



Sure. Check out

perldoc -f seek

and

perldoc -f tell

But why would one want to do that, when one has already read them to get
to where one is (assuming normal variable-lenght text sorts of lines) --
one could just hang on to them.


....


> Pete


--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read a file line by line and write each line to a file based on the5th byte scad C++ 23 05-17-2009 06:11 PM
How to read a text file line by line and remove some line kaushikshome C++ 4 09-10-2006 10:12 PM
Read a file line by line with a maximum number of characters per line Hugo Java 10 10-18-2004 11:42 AM
Creating cookies in Global.asa Session_OnStart but cannot read cookies on subsequent pages. bb ASP General 0 09-15-2004 09:56 PM
Re: how to read 10 lines from a 200 lines file and write to a new file?? Joe Wright C Programming 0 07-27-2003 08:50 PM



Advertisments