Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2018-07-20 03:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (423 votes). Check out past polls.

    Notices?