in reply to what is *undef* ?

The only way to test if something is undef is to see if it's not defined:
if (not defined $x) { print "\$x is undef\n"; }
Using undef in numeric context (like you did) makes it look like 0; using it as a string makes it look like "".

japhy -- Perl and Regex Hacker