$number_lines = 0;open(FILEHANDLE, "file.txt") or die "Can not open file.txt";while () { ++$number_lines;}close FILEHANDLE;print "The number of lines in file.txt = $number_lines.";