Or better yet, using the safer syntax options available in 5.6 and later:my $lastline = do { open my $pipe, '-|', tail => -1, $file or die "Can't spawn tail: $!\n"; <$pipe>; }; print $lastline;
Interesting. Could you please point me to the documentation of this feature? I took a look around perldoc and couldn't find it, so I am surely searching the wrong way
Thanks in advance
Ciao!
--bronto
The very nature of Perl to be like natural language--inconsistant and full of dwim and special cases--makes it impossible to know it all without simply memorizing the documentation (which is not complete or totally correct anyway).
--John M. Dlugosz
In reply to Re^3: Read Last Line of A File Only
by bronto
in thread Read Last Line of A File Only
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |