CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
starting at the end of file



Jun 14, 2005, 9:16 AM

Post #1 of 3 (749 views)
starting at the end of file Can't Post

I would like to read/process a file line by line starting with the last line and work toward the first... without reading the whole file in first. Any way to do this?

Many thanks.


Jun 14, 2005, 10:29 AM

Post #2 of 3 (745 views)
Re: [andrew_b] starting at the end of file [In reply to] Can't Post

should be able to do that with Tie::File

read the Tie::File documentation and it will explain, it's a pretty easy module to understand and use since you basically treat the file like any other perl array, even though it's not read into memory.

There are probably other ways too.

Thaumaturge / Moderator

Jun 15, 2005, 5:07 AM

Post #3 of 3 (736 views)
Re: [andrew_b] starting at the end of file [In reply to] Can't Post

As KevinR says, Tie::File can do this and is a standard part of any recent (5.8.x) version of Perl.

Another option might be File::ReadBackwards.

Dave Cross, Perl Hacker, Trainer and Writer
Get more help at Perl Monks


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives