![]() |
|
go ahead... be a heretic | |
PerlMonks |
Re: Merged list with regex matchesby Sidhekin (Priest) |
on Sep 04, 2007 at 15:49 UTC ( #636966=note: print w/replies, xml ) | Need Help?? |
On the assumption that every $cn will match at most one $bn (or that you don't care about more than the first), you could precompile a regex and use the result of the match:
Of course, the regex engine is still run through the alternatives (up until one matches), but at least it looks more elegant. :) (Oh, and it may be faster too, what with not having to recompile the regex again and again. But don't quote me on that.)
print "Just another Perl ${\(trickster and hacker)},"
In Section
Seekers of Perl Wisdom
|
|