$str ="Any help would be greatly appreciated "; $str =~ s/(\s)+/$1/g; print $str;