in reply to Is undef equal to zero

... and you aren't getting any warnings about this because you didn't use  perl -w.   An even better way of getting useful warnings is to use following two lines, which you will want to commit to memory and use at the beginning of any script that shows the least sign of a bug:
use warnings; use strict;
If you want very verbose mini-tutorials instead of a short messages, add
use diagnostics;