Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
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 surveying the Monastery: (9)
As of 2016-08-30 12:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The best thing I ever won in a lottery was:















    Results (418 votes). Check out past polls.