XP is just a number | |
PerlMonks |
Re^2: if ($2) behaves differently than if (defined $2)by radiantmatrix (Parson) |
on Apr 15, 2008 at 18:09 UTC ( [id://680611]=note: print w/replies, xml ) | Need Help?? |
That's a choice quote. Put another way, the OP is suffering from some confusion that if (defined $x) is intended to be the same as if ($x). In fact, they serve different purposes. defined tests whether a variable has any value -- a false value is still a value. Short demonstration code:
This produces the following output:
<–radiant.matrix–>
Ramblings and references The Code that can be seen is not the true Code I haven't found a problem yet that can't be solved by a well-placed trebuchet
In Section
Seekers of Perl Wisdom
|
|