Error/Warning - what's "prettier" way of achieving purpose
Rick Measham
rickm at isite.net.au
Sun Nov 24 14:34:11 CST 2002
At 6:34 AM +1100 25/11/02, David Dick wrote:
>print $cgi->header if (not defined $DEBUG); # slightly different, it
>won't print the empty string ;)
The whole point of 'unless' is to remove the 'if not' syntax so even
better would be:
print $cgi->header unless defined($DEBUG);
I would argue for using this type of snyax over ()?: because you want
to print the header. That's the point of the line. Unless you're
debugging.
With the original line the point appears to be to test if $DEBUG is
defined and if it isn't then print a header.
Small difference, but makes code easier to maintain.
Cheers!
Rick
--
--------------------------------------------------------
There are 10 kinds of people:
those that understand binary, and those that don't.
--------------------------------------------------------
The day Microsoft makes something that doesn't suck
is the day they start selling vacuum cleaners
--------------------------------------------------------
More information about the Melbourne-pm
mailing list