Extending what Eily said, eq and the other string comparison operators, impose string context to their operands. This also will not work.
defined is the only operator that reliably tests for undef.
In reply to Re^2: why can't compare a variable with undef directly?
by RonW
in thread why can't compare a variable with undef directly?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |