Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Re: Little pattern problem...by BrowserUk (Patriarch) |
on Sep 05, 2003 at 19:50 UTC ( [id://289339]=note: print w/replies, xml ) | Need Help?? |
In response to a /msg.
If the regex matches $_ (ie. the line read in from the DATA file), then the 7-digit number '\d{7}' is captured (because of the brackets) into the perl special variable $1. Because the regex matched, the if condition is true and so the value of $1 will be assigned to the variable $target_name. If that isn't clear then I suggest your find and read the documents perlrequick and perlretut, particularly the sections entitled "Extracting matches" in both. You should have copies of these on your system, but the above links will take you to the latest versions incase you haven't. They won't take long to read and they do a much better job of explaining this stuff than I would. I hope that clarifies things a little. Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller If I understand your problem, I can solve it! Of course, the same can be said for you.
In Section
Seekers of Perl Wisdom
|
|