in reply to comparing two values under 'perl -w'
That way, you can at least hide the problem and make the main code more readable.sub equalOrBothNull { my ($a, $b) = @_; ((defined($a) && defined($b) && $a==$b) || (!defined($a) && !defined($b)); }
By the way, I'm pretty sure
is not what you want.not defined($a) && not defined($b)
Not doesn't bind as tightly as !.$ perl -MO=Deparse -e'not defined($a) && not defined($b)' not defined $a && !defined($b); -e syntax OK
|
---|