use strict; my $fn="myfile"; print readfile($fn); sub readfile { my $out=""; open(FH, $fn) or die "Can't read $fn"; $out .= $_ while(); return $out; } #### use strict; { my $fn="myfile"; print readfile($fn); } sub readfile { my $out=""; open(FH, $fn) or die "Can't read $fn"; $out .= $_ while(); return $out; }