On Wed, Jan 09, 2008 at 09:45:15PM -0800, Sam wrote: > if i read you correctly, you can read the file into an array and use pop, > which will return the last element read.Or you could use @array[-1]
That's rather wasteful of memory, which becomes a concern with larger files. If the objective is indeed to get the last line in the file, then you only need a scalar to stick each line into and its final stored value will be the last line: #!/usr/bin/perl use strict; use warnings; my $last; while (<>) { $last = $_; chomp $last; } print $last, "\n"; Of course, if this is being done as a standalone operation, then just using `tail -1 filename` on the command line would definitely be easier and probably more efficient. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]