Syntactic Confectionery Delight | |
PerlMonks |
Re: Identifying if a variable is the product of a qr//by JayBonci (Curate) |
on Apr 25, 2002 at 10:59 UTC ( [id://161915]=note: print w/replies, xml ) | Need Help?? |
So I'll take a stab at this, and maybe I'm missing what you're asking. If you bless in a regular expression, it becomes a SCALAR, and as far as I can tell, there's no way to come up with the direct reference of it again, without putting it into regular expression context, like you have (but the only way I can see to do that is to actually use it). Then perl's internal magic kicks in, and blammo, it works. However, this code below, works to determine whether a blessed thingy is a regexp: lends me back:
So you can work around it, by blessing references to references in, thus making the internal reference type of 'ref' and then maybe you don't have that layer of blessed magic-ness to work around. Is it because there is no way to put a scalar in regexp context without actually running it? --jb
In Section
Seekers of Perl Wisdom
|
|