[Mpls-pm] Interesting RegEx Problem

Joshua ben Jore twists at gmail.com
Mon Sep 19 09:28:42 PDT 2005


On 19 Sep 2005 16:12:01 -0000, Gypsy Rogers <gypsy at freeq.com> wrote:
> 
> Like I said, one of my biggest motivations recently has become to make sure
> I don't have to spend time explaining my code to someone else when I hand it
> off to them to maintain.
> 
> That being said, yeah, if you have more then 3
> expressions to check the loop is probably the way to go. I just threw out
> the first thing to pop to my mind. :)

I've been hoping someone would mention List::Util::first.

 use List::Util 'first';
 $matching_expression = first { $text =~ $_ } @candidate_expressions

Josh


More information about the Mpls-pm mailing list