$str= " perlmonks is the coolest"; $str =~ s/\s+/_/g; print $str;