my $fname = 'data.txt'; open FH, "<", $fname or die "Couldn't open $fname: $!"; while(FH) { print "hello\n"; }