Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: creating qr from existing regexby vr (Curate) |
on Feb 09, 2018 at 11:15 UTC ( [id://1208812]=note: print w/replies, xml ) | Need Help?? |
Not an answer, just a comment. Do I get it right:
It doesn't make much sense to me, but I haven't worked with MongoDB, hence not an answer, but a promised comment. The reason you get an undef in OP, is because $re are 2 separate lexical variables, 1 per each own small block. They are declared with my and destroyed at closing curly bracket. What's assigned to $_[0], in next line, is presumably global, completely different $re, and undefined at that time. You don't use strict;, do you? I think this change
would give you the result you were hoping for. Edit: Fixed numeric comparison operator to string comparison eq (thanks, poj).
In Section
Seekers of Perl Wisdom
|
|