in reply to Find last line in Text file parsing

One simple way is below. The below code will run very fast and will work with files too large to fit into memory at once. If you have special special performance requirements and/or if the files are humongous, then please explain further. Otherwise I would recommend going with something simple.
#!/usr/bin/perl -w use strict; my $file = "somefile"; open (FILE, '<', $file) or die "unable to open $file\n"; my $first_line = <FILE>; my $last_line; while(<FILE>){$last_line = $_;} print "$first_line"; #do what you need with them here print "$last_line";