Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Answer: How do I copy out the last line written in a file?

( #408296=categorized answer: print w/ replies, xml ) Need Help??

Q&A > files > How do I copy out the last line written in a file? contributed by I0

use Tie::File:
use Tie::File; sub last_line_of_file { my $file = shift; tie my @array, 'Tie::File', $file or die "read $file - $!"; $array[-1] }

Comment on Answer: How do I copy out the last line written in a file?
Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2014-12-17 20:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (32 votes), past polls