my $str = "Hello\n\t\n World\n"; print $str; $str =~ s/\s+/ /g; print $str;
Output
Hello World Hello World
Update: Please note this replaces all whitespace chars to a single space char. So if you have leading/trailing spaces please go with Your Mother's solution!
In reply to Re: How to remove \n between two words but retain one space
by sk
in thread How to remove \n between two words but retain one space
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |