A self-contained solution that leaves no footprint or side-effects behind. ...all that comes out of the do{...} block is the result you seek.
my $data = do{ open my $file, '<', $filename or die $!; local $/ = undef; local $_ = <$file>; s/\n+/ /g; $_; };
Dave
In reply to Re: read file into 1 line string
by davido
in thread read file into 1 line string
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |