in reply to Re: Replacing multiple spaces into one character?
in thread Replacing multiple spaces into one character?

Agreed, it works exactly as r.joseph presented it. However you may want to think about using
$str =~ s/ +/_/g;
instead, since it doesn't mess with your newline characters. That is, with your version "perl\n" becomes "perl_".

- Boldra