On Jun 13, Charles Lu said:

>$hash{s} = "T";
>
>
>if(exists($hash{s}) and $hash{s} ne "T" or $hash{s} ne "F") {
>       print "inside\n";
>}
>else{  print "outside\n"; }

'or' is less "clingy" than 'and'.  Therefore, your code parses like:

  if (
    (exists $hash{s} and $hash{s} ne "T")
    or
    ($hash{s} ne "F")
  ) { ... }

Change the parenthesization to suit your needs:

  if (exists ... and (this or that)) { ... }

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl Regex book      **

Reply via email to