http://www.perlmonks.org?node_id=1048869


in reply to Contents of a file into a scalar

File::Slurp handles all of the file i/o, so you don't need to open the file first. Try the following:

use strict; use warnings; use File::Slurp; my $string = read_file 'QBF.txt'; print "\n"; print $string . "\n"; print "\n";