{ open(my $fh, "somefile.txt") or die("ack - $!"); sub readfile { return <$fh>; } } print while readfile();