in reply to switching default line terminator?

Use the 'local' keyword

my $filename = 'foo.txt'; open my $fh, '<', $filename or die; my $content; { local $/ = undef; $content = <$fh>; } # $content contains the full file content now.

Cheers, Flo