Perl's a weakly-typed language (almost untyped, really). Magic lurks at every nook and cranny. This stuff comes with the territory.
Quite the opposite. This "issue" is a symptom of the the very strict requirements operators place on the type of their operands. == requires numbers, so Perl converted the undefined value to a number.