in reply to Re: Re: Defined or Undefined - That is the question.
in thread Defined or Undefined - That is the question.
I believe the authors meant that there is no keyword that means "elsif (not EXPR)" in the way that "unless (EXPR)" means "if (not EXPR)." You can, however, use elsif and else with unless:
There is no "elsunless" though. This is generally construed as a feature.
I hope this clears things up for you.foreach $a ( 0,1,2 ) { unless ( $a ) { print "a is 0 or undef\n"; } elsif ( $a == 1 ) { print "a is 1\n"; } else { print "a equals $a\n"; } } __END__ a is 0 or undef a is 1 a equals 2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (sacked: unless/else) Re: Re: Re: Defined or Undefined - That is the question.
by michael (Sexton) on Mar 14, 2001 at 06:07 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |