in reply to How do I read an entire file into a string?

or, if not able to unset $/ due to some other limitations in the script:
open FILE, "myfile" or die "Couldn't open file: $!"; 
while (<FILE>){
 $string .= $_;
}
close FILE;

Originally posted as a Categorized Answer.

  • Comment on Re: How do I read an entire file into a string?