open my $fhFile, '<', 'theFile' or die $!; my $slurpedFile; { local $/; $slurpedFile = <$fhFile>; } close $fhFile; ## Supplying a reference to a scalar as the filename ## initiates the opening of a ram file. open my $fhRam, '<', \$slurpedFile or die $!; ## Now file operations on $fhRam will read from the slurped scalar my $firstLine = <$fhRam>; ...