Unless I am mistaken you are trying to show that unless the first condition is false or that the second considition is false, then print the stuff in the
else statement(kind of akin to an
if/elsif/else construct, but for unless). At least that is the jist of what I got from your post (forgive me if I am wrong, but want to make sure that no one is led astray here).
Anyhow the reason WHAT?!!! is printed is not because neither of the unless conditions were false (and hence executed), but because the second statement's condition (i.e. unless( 2 ){ .. } ), was true (and not executed), and thus the else that follows is executed. For example:
use strict;
use warnings;
my $foo = 1;
my $bar = 2;
my $baz = 3;
unless ( $foo == $bar ) { print "TEST 1\n"}
unless ( $foo != $baz ) { print "TEST 2\n" }
else { print "TEST 3\n"}
will print both "TEST 1" and "TEST 3"
-enlil
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.