Jun 17, 2001, 2:05 PM
Post #2 of 3
open (FILE "file.txt");
@list = <FILE>;
$amount = grep(/\n/, @list); # this will work if you have one line per item needed.
$amount--; #this decriments the number by 1 to make it compatable with starting at 0
print qq~ the last line in the file is @list[$amount]\n~;
i havent tested this, but it should work.
also, if you are familiar with unshift, you could use that function to reverse the order, and then pull out the first, which actually is the last. but that is only if it fits your needs.
I Hope this helps...
perl programmers don't die.. they just start writing a new script.