in reply to Any difference in conditionals?

Debugging. Type 1 has an additional break point that type 2 does not:

# conditional type1 if ($x1) { warn "x1 was true\n"; if ($x2) { warn "x2 was true\n"; print "here\n"; } } # conditional type2 if ($x1 && $x2) { warn "well, they were both true ... still don't see the bug\n"; print "here\n"; }
Now, the examples are very trivial, but i really have picked a more verbose style over another just so i could debug easier -- verbose can still be terse with Perl, though. ;)

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re: Re: Any difference in conditionals?
by awwaiid (Friar) on Apr 28, 2004 at 05:24 UTC
    This thought got me thinking...
    if($x1 && (warn '$x1 OK... ') && $x2) { print "here\n"; }
    ... works like one might want it to work :)

    So _technically_ even this method allows for debugging.

    --Brock