<?xml version="1.0" encoding="windows-1252"?>
<node id="1005037" title="Re^5: Space between digits" created="2012-11-21 20:35:36" updated="2012-11-21 20:35:36">
<type id="11">
note</type>
<author id="333489">
muba</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;c&gt;my $string = "(\d+)\:(\d+) (\d+)\/(\d+)\/(\d+)";&lt;/c&gt;&lt;/blockquote&gt;
&lt;p&gt;What is the purpose of this line? Does it really help you to do what you want to? What happens if you leave it out entirely?&lt;/p&gt;

&lt;p&gt;s/// works in place (that is, on the variable it is bound to). What happens if you rewrite it as this:&lt;/p&gt;

&lt;c&gt;
if ($_ =~ m/(\d+)\:(\d+) (\d+)\/(\d+)\/(\d+)/ ){
    $_ =~ s/ /     /;
}
&lt;/c&gt;

&lt;p&gt;And of course, m// and s/// works on $_ in lieu of any other variable, so you could even just go:&lt;/p&gt;
&lt;c&gt;
if (m/(\d+)\:(\d+) (\d+)\/(\d+)\/(\d+)/ ){
    s/ /     /;
}
&lt;/c&gt;

&lt;p&gt;Which could be shortend to:&lt;/p&gt;
&lt;c&gt;
s/ /   / if  m/(\d+)\:(\d+) (\d+)\/(\d+)\/(\d+)/;
&lt;/c&gt;

&lt;p&gt;Those parens serve no purpose, as you're seemingly not capturing anything, so we can be even more briefer without harming readability:&lt;/p&gt;
&lt;c&gt;
s/ /   / if m/\d+\:\d+ \d+\/\d+\/\d+/;
&lt;/c&gt;

</field>
<field name="root_node">
1005011</field>
<field name="parent_node">
1005018</field>
</data>
</node>
