in reply to Re^3: Regex result being defined when it shouldn't be(?)
in thread Regex result being defined when it shouldn't be(?)

defined $var ... will return undef (which is a FALSE value) if the variable is undefined.

Sorry, that's not quite correct, compare the outputs of the following:

$ perl -wMstrict -MDevel::Peek -le 'my $x = undef; Dump( $x )' $ perl -wMstrict -MDevel::Peek -le 'my $x = !1; Dump( $x )' $ perl -wMstrict -MDevel::Peek -le 'my $x = defined(undef); Dump( $x ) +'

(Update: Whoops, just saw your update, you saw that yourself)

The rest of your post is excellent though, so no worries about the duplicated efforts, TIMTOWTDI :-) I especially like the comparison with C, and it makes another important point: comparing a true/false value explicitly is brittle: If defined decided to return 0 as a false value instead, then defined(...) eq "" will break!