in reply to String equality and undef
Now, you could turn off warnings for this case; clearly you intended to use an undefined value, so there's no point for Perl to warn you.
However, comparing the 'undef' can be the wrong thing. In string context (and that's what the operands of 'eq' will be in), undef becomes the empty string. So, if $id can be an empty string, you might get the wrong thing.
You can solve both issues by using
as your first test.if (!defined $id)
|
|---|