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