#opening the file for reading open IN,"$fileName" ; #reading the whole file into an array. my @F=; close IN; #reading the last line of the file my $lastLine=$F[$#F]; #reading the first line of the file my $firstLine=$F[0];