my $last; { local $_; open FILE, "<myfile" or die "opening myfile: $!\n"; $last = $_ while <FILE>; close FILE; # last line in $last. }
((added:) ...read the file, keep track of each line read in $last. At the end, $last will contain the last line successfully read.)
In reply to Re: Reading the last line of a file in a Pure Way.
by wog
in thread Reading the last line of a file in a Pure Way.
by hackmare
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |