in reply to what is *undef* ?
It was not $a (equaling zero) which was coerced to equal undef. Just the opposite. It was the undef that, in a numerical context (occasioned by the '==' test), was coerced into being taken as zero.print "undef evaluates as zero in a numerical context" if (undef == 0);
Further evidence of what Perl is doing can be obtained by running with -w in your hash-bang line. Perl will complain: Use of uninitialized value in numeric eq (==) at myprog.pl line 4. and then do its best to render an acceptable result by treating the undef as zero and concluding that the test succeeds.
HTH
|
|---|