in reply to String equality and undef

Well, considering that 'undef', is, uhm, an "unintialised value", and that you use it as an argument to 'eq', I am not at all surprised at the warning.

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

if (!defined $id)
as your first test.