in reply to Re: What is the best way to compare variables so that different types are non-equal?
in thread What is the best way to compare variables so that different types are non-equal?
Regex pattern objects are magical. Overloading doesn't even come into play.
Magical is right. This took me by surprise.
use overload; use Scalar::Util qw( blessed ); use Test::More 'tests' => 4; my $rx = qr/a/; ok blessed $rx, 'Regexp is blessed'; ok ! overload::Overloaded( $rx ), 'Regexp is overloaded'; ok ! overload::Method( $rx, q{""} ), 'Regexp has q{""} overloaded'; isnt "$rx", overload::StrVal( $rx ), 'StrVal of regexp isnt regexp stringified';
In Section
Seekers of Perl Wisdom