use Path::Tiny qw/ path /; my $rawfile = path( $file )->slurp_raw open my($filehandle), '<:raw', \$rawfile; ## in memory ... close $filehandle;