in reply to Find last line in Text file parsing
Its right you do not have to open file twice. If the files are small... you can always place file contents in and array and use them.
open(FILE, "< nanotest.txt") || "can't open $file: $!"; my @arr = <FILE>; my $last = $#arr+1; ## you can also use $. instead of $#arr my $count; foreach (@arr) { $count++; if ($count == $last) { # Validate last line } }
|
|---|