use Path::Tiny qw/ path /; my $foo = path($file)->slurp_utf8; my $foo = path($file)->slurp_raw; my $foo = path($file)->slurp( {binmode => ":raw"} );