# print entire file open FH,'foo.txt'; my $foo = do {$/ = undef;}; print $foo; # print only first line open FH,'bar.txt'; my $bar = ; print $bar;