in reply to Surprising result when using undef

I would not have thought that "( $an_undefined_variable == 0 )" would evaluate to true because, golly, undef isn't a number and so the "==" operator is testing whether one number is the same as another number.

The "==" operator is comparing the left hand side and the right hand side in numeric context.
And, in numeric context, undef and 0 are equivalent:
C:\>perl -e "print 'ok' if undef == 0;" ok C:\>
But in string context, it's a different matter:
C:\>perl -e "print 'ok' if undef eq 0;" C:\>

Cheers,
Rob