in reply to put file content into a string

I have a method that does something like that, and it looks like this:
open IN, "<myFile"; while(<IN>) { # read the file in, line by line $str .= $_; } close IN;