in reply to And plus OR
I show 2 different version of the "if", both do the same thing. This is called DeMorgan's theorem. Note that the "ne" becomes "eq" in the second version. I like the first version better, but your call... they are the same logically.#!usr/bin/perl use strict; use warnings; my $security = "xxx"; my $username = "xxx"; my $type = "Check In"; if ($username eq "$security" and $type ne "Check In" and $type ne "Che +ck Out" ) { print "if executed, username=$username type=$type\n"; } else { print "if not executed, username=$username type=$type\n"; } __END__ if not executed, username=xxx type=Check In *** This is the same thing:*** if (($username eq "$security") and !( $type eq "Check In" or $type eq +"Check Out") )
|
|---|