in reply to put file content into a string
The idiomatic construct would be:
open( IN, "<", $file ) or die "Can't open: $file: $!\n"; my $str = do { local $/; <IN> }; close( IN ); [download]
See perlvar for more info on $/.