Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Syntactic Confectionery Delight
 
PerlMonks  

Re: Determining which pattern matched

by rubasov (Friar)
on Apr 02, 2010 at 13:40 UTC ( #832483=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    while ( $str =~ m/($pat1|$pat2|$pat3)/ig ) {
      print "Found '$1' from pattern ", keys %+, "\n";
    }
    
  2. or download this
    my $pat_id;
    
    ...
    while ( $str =~ m/($pat1|$pat2|$pat3)/ig ) {
      print "Found '$1' from pattern pat", $pat_id, "\n";
    }
    
  3. or download this
    my $pat_id;
    our $REGMARK;
    ...
    while ( $str =~ m/($pat1|$pat2|$pat3)/ig ) {
      print "Found '$1' from pattern ", $REGMARK, "\n";
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://832483]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2014-04-20 21:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (488 votes), past polls