# odd way to count lines of a file :-) use strict; use warnings; use IO::Handle; my $fh = IO::Handle->new; #good # $fh = do {local *FH}; #bad open ($fh, './test') or die("open failed: $!"); 1 while <$fh>; print "line: " . $fh->input_line_number(); __END__