On 6/1/07, Paul Lalli <[EMAIL PROTECTED]> wrote:
On Jun 1, 11:21 am, [EMAIL PROTECTED] (Chas Owens) wrote:
> On 6/1/07, Paul Lalli <[EMAIL PROTECTED]> wrote:
> snip> if (! $ftp ) {
>
> snip
>
> Ugh, use unless () {} rather than if (! ) {}.

Ugh.   Never.  The only time unless should ever be used is in postfix
notation, as in:

die "No arguments passed in!" unless @_;

Otherwise, unless is bulky, a waste of space, confusing to new Perl
programmers,
snip

Ah, then we have a disagreement.  I find the "!" gets lost when
scanning code and if you use "not" instead then you might as well have
used the unless.

snip
and unscalable.  (As soon as you add an 'else' clause,
people have to read it two or three times to understand what's being
done).  Avoid at all costs.

Paul Lalli
snip

Which is why you never use an unless with an else.  If you have

unless ($foo) {
   print "false\n";
}

and you find you need an else you change it to an if

if ($foo) {
   print "true\n"
} else {
   print "false\n";
}

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to