Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (1)
As of 2023-06-05 19:46 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (25 votes). Check out past polls.