untested, but here's my theory:
you're having precedence problems, try parenthesizing!
ie,
if( exists($hash{s}) and ( ($hash{s} ne "T") or ($hash{s} ne "F") ) ) {
hth,
Jos Boumans
Charles Lu wrote:
> The following snippet of code doesn't behave the way I want it to. Yet i
> cannot see why?
>
> $hash{s} = "T";
>
> if(exists($hash{s}) and $hash{s} ne "T" or $hash{s} ne "F") {
> print "inside\n";
> }
> else{ print "outside\n"; }
>
> the OUTPUT of this program prints "inside". But I want it to go INSIDE
> only if the key "s" exists in the hash, AND the value of $hash{s} DOES NOT
> equal "T" OR "F". Can anyone suggest what I might be doing wrong here?
> By the way, even if I comment out the line that contain
> $hash{s} = "T";, the output still goes to "INSIDE".
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com