in reply to defined vs null string
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 ''».
|
|---|