while (s/\n/ /s) { # remove the newlines my $out = $_; print $out; }