<?xml version="1.0" encoding="windows-1252"?>
<node id="1021620" title="Replacing whitespaces with a regex" created="2013-03-04 04:52:13" updated="2013-03-04 04:52:13">
<type id="115">
perlquestion</type>
<author id="1007874">
Dr Manhattan</author>
<data>
<field name="doctext">
&lt;p&gt;Hi all&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;code&gt;foreach my $words (@array)
{
    if ($words =~ /(\s\s)$/)
    {
        #??? replace with just 1 \s
    }
}&lt;/code&gt;

&lt;p&gt;Or is there an easier way? Any help would be appreciated&lt;/p&gt;</field>
</data>
</node>
