Sunday, June 27, 2010

Perl and "booleans"

Note to self:

While the value of

$maybeBooleanResult = (2 == 2);

is

1

as would be expected, the value of

$maybeBooleanResult = (2 == 3);

is

''

rather than

0


This is not what I expected, and caused problems when I was writing code like

print "flag = $maybeBooleanResult\n";

No comments:

Post a Comment