Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
Perl: the Markov chain saw
 
PerlMonks  

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

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://25207]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.