in reply to What is the best way to compare variables so that different types are non-equal?
What you are seeing, are the effects of overload for Regexp objects.
You can use == to compare
Regexp objects are a special case (isn't everthing), you can call methods on them, but you can't dereference themuse strict; use warnings; my $re =qr{a}; my $re2 =qr{a}; warn $re == $re2; warn $re2 == $re2; warn 0+$re; warn 0+$re2; __END__ Warning: something's wrong at - line 8. 1 at - line 9. 2252896 at - line 10. 2252956 at - line 11.
In Section
Seekers of Perl Wisdom