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


in reply to Clawing my way out of operator overloading hell

These scalars are not primitive strings, so clearly for this statement to be of any use, someone, somewhere in the inheritance hierarchy has overloaded the 'eq' operator.

Regardless of whether or not that is true in your case, it isn't a foregone conclusion in every case. If you know that two scalars contain references, a string comparison will tell you whether or not they refer to the same thing.

$ perl -le 'my $foo = \1; my $bar = $foo; print "same" if $foo eq $bar +' same
-sauoq
"My two cents aren't worth a dime.";