http://qs1969.pair.com?node_id=1021620

Dr Manhattan has asked for the wisdom of the Perl Monks concerning the following question:

Hi all

I have an array containing a list of words. Some of the words contain a whitespace at the end, which is fine. I want to replace those elements with more than 1 whitespace at the end.

foreach my $words (@array) { if ($words =~ /(\s\s)$/) { #??? replace with just 1 \s } }

Or is there an easier way? Any help would be appreciated