eq is the string comparison operator. It compares strings. It therefore needs strings. If you pass it something that isn't a string, it's coerced into a string. In the case of undef, that means an empty string, but you get a warning for doing this.
You want «defined($y) && !length($y)» or «defined($y) && $y eq ''».
In reply to Re: defined vs null string
by ikegami
in thread defined vs null string
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |