<html><body bgcolor="#FFFFFF"><div><br></div><div>On Sep 12, 2009, at 9:42 AM, Richard Reina &lt;<a href="mailto:richard@rushlogistics.com">richard@rushlogistics.com</a>&gt; wrote:<br><br></div><div></div><blockquote type="cite"><div><span>I think I've got it now. I found this:</span><br><span></span><br><span>$mystring = "[2004/04/13] The date of this article.";</span><br><span>if($mystring =~ m/(\d+)/) {</span><br><span> &nbsp; &nbsp;print "The first number is $1.";</span><br><span>}</span><br><span></span><br><span>in a tutorial at <a href="http://www.somacon.com/p127.php"><a href="http://www.somacon.com/p127.php">http://www.somacon.com/p127.php</a></a></span><br><span></span><br><span>and hacked it up so that my number gets the value of</span><br><span></span><br><span>$number = $1 </span><br><span></span><br><span>and it works.</span><br><span></span><br><span>However, I am confused by the representation of the scalar $1 I have never seen that before. &nbsp;Can someone explain $1. &nbsp;Or is it something that should not be explained but instead accepted at face value?</span><br></div></blockquote><div><br></div>It says on that page, right above your example:<br><span class="Apple-style-span" style="font-family: Arial; font-size: 16px; -webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); "><p style="text-align: justify; ">Prints "The first digit is 2." In order to designate a pattern for extraction, one places parenthesis around the pattern. If the pattern is matched, it is returned in the Perl special variable called $1. If there are multiple parenthesized expressions, then they will be in variables $1, $2, $3, etc.</p><div style="text-align: justify;"><br></div></span></body></html>