SPUG: Last night's meeting
Michael R. Wolf
MichaelRWolf at att.net
Wed Mar 17 15:24:37 CST 2004
Brian Hatch <bri at ifokr.org> writes:
[...]
> print STDERR "random annoying debug statement\n" if $DEBUG;
>
> Just slap those 'if $DEBUG' tags on as needed. Or to save typing
>
> $DEBUG && print STDERR "random annoying debug statement\n";
>
> Also has the benifit of making it obvious as you scan the left hand side
> of the script that you need not read this line.
Nicely paralleled. I like *both* styles, and like that you point to
the left-to-right scanning.
I like to put the most important thing left-most. Occasionally that's
the argument to print, occasionally it's the truth state of the debug
flag.
P.S. Thanks for slipping the STDERR arg in, something I had left out
of my previous examples. Debug output should not pollute STDOUT.
--
Michael R. Wolf
All mammals learn by playing!
MichaelRWolf at att.net
More information about the spug-list
mailing list