use strict; use Tie::File; my $f = shift; my $l = shift -1; tie my @f => 'Tie::File' => $f; print "$l: $f[$l]"; #### perl -w gfarhat.pl testfile.txt 1 perl -w gfarhat.pl testfile.txt 2 ... perl -w gfarhat.pl testfile.txt 9998 #### perl -nle 'BEGIN{$l=pop}print if $.==$l' testfile.txt 1