Small variation of the previous solutions, replace any spaces (even 1 space) with 1 space:
for ( @array ) { s/\s+$/ / }
In reply to Re: Replacing whitespaces with a regex
by Anonymous Monk
in thread Replacing whitespaces with a regex
by Dr Manhattan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |