#Read a file, print its line to the screen. $input_file = "sample.txt"; open (INFILE, $input_file) or die "The file $input_file could not be found"; # Loop, continuing as long as a line can be read successfully from the file while ($line = ) { $line_count++; print "$line_count $line"; } close INFILE;