Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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: (8)
As of 2014-09-19 07:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (132 votes), past polls