There was a typo in my original email. I missed the word "not" which was very 
crucial as always.

Scenario: #1
unless ( (defined $result) && ($test !~ /TEST/) )
 { my $result = "OK";
   print "$result\n";
 }
I thought it was:
UNLESS $result is defined and UNLESS $test does not contain TEST = IF $result 
is not defined and if $test contains TEST.

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 
not 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
On Thursday 29 Apr 2010, Akhthar Parvez K wrote:
> 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
> 


Reply via email to