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 FunkyMonk (Chancellor)
on Apr 02, 2010 at 13:46 UTC ( [id://832484]=note: print w/replies, xml ) Need Help??


in reply to Determining which pattern matched

As an alternative to the above, you could do something like...

my @patterns = ("field", "f.i.e.l.d", "the"); my $str = "There are many soccer fields in England - f1i2e3l4d f1i2e3l +4d"; my %matches = map { $_ => [ $str =~ /$_/g ] } @patterns; __END__ { "f.i.e.l.d" => ["f1i2e3l4d", "f1i2e3l4d"], field => ["field"], the => [], }

Unless I state otherwise, all my code runs with strict and warnings

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-24 08:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found