http://qs321.pair.com?node_id=445846


in reply to What is true and false in Perl?

undef # evaluates to "" so it's false -- note, you may get a warni +ng "use of uninitialized value if you are using -w

I belive you can not get such a warning, an undefined value is always false without any warning when interpreted as a boolean.

From perlsyn, section Declarations (it's so well hidden):

A variable holds the undefined value ("undef") until it has been assigned a defined value, which is anything other than "undef". When used as a number, "undef" is treated as 0; when used as a string, it is treated as the empty string, ""; and when used as a reference that isn't being of an uninitialized value whenever you treat "undef" as a string or a number. Well, usually. Boolean contexts, such as
my $a; if ($a) {}
are exempt from warnings (because they care about truth rather than definedness).