in reply to Replacing multiple spaces into one character?

This uses the magical whitespace arg to split:

my $str = " Perlmonks is the\tcoolest\n \tplace"; $str = join "_", split " ", $str; print $str,$/;
The magic strips leading whitespace and is greedy about the rest. This is a little broader than you asked for, but still does what you want.

After Compline,
Zaxo