I really don't understand your example. I substituted warns with prints:
use strict; use warnings; my $re =qr{a}; my $re2 =qr{a}; print $re == $re2,"\n"; print $re2 == $re2,"\n"; print 0+$re,"\n"; print 0+$re2,"\n";
and this is the result:
sini@ordinalfabetix:~$ ./x.pl 1 135589228 135591376 sini@ordinalfabetix:~$
The last two lines are NOT equal, because are references to two different scalars. And, as a consequence, $re != $re2 (and $re == $re, but it was expected).
So numerical comparison doesn't tell you if two regex are equal, but only if they are the same (reference).
Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."
In reply to Re^2: What is the best way to compare variables so that different types are non-equal?
by psini
in thread What is the best way to compare variables so that different types are non-equal?
by ELISHEVA
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |