Yes and? Your qr// expression interpolated and then fixed the constant into place. Normally I'd just eschew that as a particularly ugly form of a regex though. In fact, I'd likely have written that as this instead. I'd be using the constant like its intended (as in, not like a cleverly named function) and I still get something reasonable. Now other people like Perrin have been convincing me that constant isn't all that great anyway especially given the bareword quoting rules with the => fat comma and interpolation (like you noticed).
use constant FOO => 'bar'; my $x = FOO; $x = qr/$x/; "somehting" =~ $x
So actually, I wouldn't have written it at all like that. This is more likely. Though I wouldn't have gone out of my way to create a qr// object if I was only going to use it in one place anyway. That looks like something that'd be better written as merely "something" =~ $FOO.
our $FOO = 'bar'; my $x = qr/$FOO/; "something" =~ $x;
In reply to Re: Re: /o is dead, long live qr//!
by diotalevi
in thread /o is dead, long live qr//!
by diotalevi
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |