http://www.perlmonks.org?node_id=39472

Compilers-R-Us has asked for the wisdom of the Perl Monks concerning the following question:

I have a question related to "Calling a method within a double-quoted string" - I would like to call a method within regex match expression, like
print "Matched!" if $myvar =~ /\Q$myob->print\E/;
I can almost do it with 5.005+ as in:
print "Matched!" if $myvar =~ /(?{$myob->escaped})/;
However, I have to pre-escape the return result. Of course I can use a temporary variable, but that damages the readability. Unfortunately, I am stuck at 5.004 compatibility and (?{...}) is not supported. Also, I feel that it is my birthright to do this in one line. Is there a one-liner to do this? Also, is there a reason that the binding is not stronger for '->'?

Originally posted as a Categorized Question.