Front page | perl.beginners |
Postings from April 2010
unless with AND
Thread Next
From:
Akhthar Parvez K
Date:
April 29, 2010 04:25
Subject:
unless with AND
Message ID:
201004291655.26684.akhthar@sysadminguide.com
Hi,
Could someone explain this condition:
Scenario: #1
unless ( (defined $result) && ($test !~ /TEST/) )
{ my $result = "OK";
print "$result\n";
}
I thought it was:
UNLESS (IF NOT) $result is defined and UNLESS (IF NOT) $test does contain TEST
But that doesn't seem to be the case.
I find it strange to learn that the below condition is not the same:
Scenario: #2
unless (defined $result)
{
unless ($test !~ /TEST/)
{ my $result = "OK";
print "$result\n";
}
}
This would work as I thought (UNLESS $result is defined and UNLESS $test does contain TEST), but not the scenario #1.
Regards,
Akhthar Parvez K
http://Tips.SysAdminGUIDE.COM
UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity - Dennie Richie
Thread Next
-
unless with AND
by Akhthar Parvez K