in reply to read file into 1 line string
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
|
|---|