Re: unless with AND

2010-04-29 Thread Randal L. Schwartz
> "Shlomi" == Shlomi Fish writes: Shlomi> just a short question. besides personal preference is there Shlomi> any difference if you use if(! or unless(? Shlomi> sts: no. Shlomi> sts: they do the same thing. That's actually not true. if ($foo) vs unless (not $foo

Re: unless with AND

2010-04-29 Thread Akhthar Parvez K
On Thursday 29 Apr 2010, Shlomi Fish wrote: > On Thursday 29 Apr 2010 14:39:11 Akhthar Parvez K wrote: > > 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 $resu

Re: unless with AND

2010-04-29 Thread Akhthar Parvez K
On Thursday 29 Apr 2010, Uri Guttman wrote: > i recomment never using !~ as it doesn't read well and it makes for poor > boolean tests. also i rarely use unless for complex (2 or more) boolean > ops for the same reason. > >   APK>  { my $result = "OK"; >   APK>    print "$result\n"; >   APK>  } >

Re: unless with AND

2010-04-29 Thread Shlomi Fish
On Thursday 29 Apr 2010 14:39:11 Akhthar Parvez K wrote: > 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"; > } This unless with

Re: unless with AND

2010-04-29 Thread Uri Guttman
> "APK" == Akhthar Parvez K writes: APK> There was a typo in my original email. I missed the word "not" which was very crucial as always. APK> Scenario: #1 APK> unless ( (defined $result) && ($test !~ /TEST/) ) i recomment never using !~ as it doesn't read well and it makes for poor b

Re: unless with AND

2010-04-29 Thread Akhthar Parvez K
On Thursday 29 Apr 2010, Shawn H Corey wrote: > !( A && B ) === !A || !B Thanks Shawn, had learnt it a few years back, but forgot that it seems and eventually got confused :-) Regards, Akhthar Parvez K http://Tips.SysAdminGUIDE.COM UNIX is basically a simple operating system, but you have to be

Re: unless with AND

2010-04-29 Thread Shawn H Corey
Akhthar Parvez K wrote: 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 doe

Re: unless with AND

2010-04-29 Thread Akhthar Parvez K
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 $r

unless with AND

2010-04-29 Thread Akhthar Parvez K
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