A shorter method, which may or may not work, depending on context, is
(($x || 0) eq ($y || 0))
However, if 0 is a legitimate value for your code (as it probably is if undef is), you can try to find something that isn't. I'd try something like the default seperator variable (
$;), which prints as a weird symbol on my machine.
(($x || $;) eq ($y || $;))
If you take the extra spaces out, that's 18 chars.
elusion : http://matt.diephouse.com
Update: This wasn't in response to the hash aspect of the meditation, sorry.