licking9Volts has asked for the wisdom of the Perl Monks concerning the following question:
Is there a way to know exactly which phrase matched and assign it to variable? Example:if (/\bAPI|APIN|UWI\s*\./) { $myvar = $something; }
or would I have to:if (/\bAPI|APIN|UWI\s*\./) { somesub($matchedpart); }
I've just started using PERL a couple of weeks now, so any advice would be greatly welcomed.if (/\bAPI|APIN|UWI\s*./) { $matchedpart =~ /\bAPI|APIN|UWI\s*./; somesub($matchedpart); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Quick question on matching
by kappa (Chaplain) on May 21, 2002 at 16:45 UTC | |
|
Re: Quick question on matching
by c-era (Curate) on May 21, 2002 at 16:45 UTC | |
|
Re: Quick question on matching
by arunhorne (Pilgrim) on May 21, 2002 at 16:55 UTC | |
|
Re: Quick question on matching
by VSarkiss (Monsignor) on May 21, 2002 at 16:50 UTC | |
|
Re: Quick question on matching
by graff (Chancellor) on May 21, 2002 at 16:50 UTC | |
|
Re: Quick question on matching
by ph0enix (Friar) on May 21, 2002 at 16:52 UTC | |
|
Re: Quick question on matching
by licking9Volts (Pilgrim) on May 21, 2002 at 18:55 UTC |