use strict; use warnings; my $fileName = shift; #open the file and copy to an array open my $fh, "<", $fileName or die "Cannot Open File: $!"; my @aFile = <$fh>; close $fh; # use $aFile[-1] for the last line, and $aFile[5] for the 6th line $aFile[5] = qq();