in reply to Re: unless vs. bare block
in thread unless vs. bare block

unnecessarily verbose. In the first example, you could achieve the same end with:

That's a syntax error:

$x=1; unless( $x ) or warn 'Erk!';; [syntax error at (eval 11) line 1, near ") or"

Remember that unless is a 'negative' if, and Perl doesn't support if without a block.

Ie. In perl, if( cond ) statement must be coded as if( cond ) { statement; }


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^3: unless vs. bare block
by Anonymous Monk on May 10, 2012 at 04:12 UTC
     warn "can't open ... " unless open ...;
      If is necessary to wear a crash helmet when riding a motorbike.
      You don't have to wear a crash helmet when riding a pushbike.

      Both true statements; the presence of 'bike' in both does not make them contradictory.

      Ditto: unless( cond ) { statement; } and statement unless cond;.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?