When you have the time read perlre
If you're in a rush... skip down to the section on "Quantifiers". TIMTOWTDI. Pick the way which you think you'll stand the best chance of understanding 3 weeks or 3 months from now when you're asked to tweak your code.
Both:
$work =~ s/\s+$/ /; # more than once
and
$work =~ s/\s{2,}$/ /; # at least twice
should work.
In reply to Re: Replacing whitespaces with a regex
by ggoebel
in thread Replacing whitespaces with a regex
by Dr Manhattan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |