Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Is there a way to read a file backwards?

by jlp (Friar)
on Jul 31, 2000 at 07:55 UTC ( #25207=note: print w/replies, xml ) Need Help??


in reply to Is there a way to read a file backwards?

If you're not worried about memory consumption, you could just do:

 my @reverse_lines = reverse <FH>;

This will read the whole file into memory, and is thus not very memory efficient, but it is probably the simplest way to do what you want.

UPDATE: Whoops, that'll teach me to not read closely enough; I just noticed you said you didn't want to read the whole file; sorry. :\

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://25207]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2018-10-17 06:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (90 votes). Check out past polls.

    Notices?