$work =~ s/\s+$/ /; # more than once #### $work =~ s/\s{2,}$/ /; # at least twice