[Mpls-pm] Interesting RegEx Problem
Gypsy Rogers
gypsy at freeq.com
Mon Sep 19 09:42:26 PDT 2005
Congradulations, your hope has been forfilled, someone just did: You!
*winks*
On Mon, 19 Sep 2005 11:28:42 -0500, Joshua ben Jore <twists at gmail.com> wrote :
> 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