$str = join ' ',<>; #### { local $/; # Temporarily set $/=undef: "total slurp mode" $str = <>; # Slurp it all in one go! }