http://www.perlmonks.org?node_id=1021621


in reply to Replacing whitespaces with a regex

Just do
$words =~ s/\s\s+$/ /;
whithout any if. If there is multiple whitespace, it will be replaced, if not, nothing happens.
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ