Help for this page
open FH, '<', 'file.txt' or die ("Can't read file: $!"); until( eof(FH) ) { print <FH>; }
open FH, '<', 'file.txt' or die ("Can't read file: $!"); ... #loop ends automatically when you reach EOF printf "File had %d lines, with an average length of %d chars\n", $lines, ($total_length / $lines);