... use constant READ_PERM => 0x04; use constant WRITE_PERM => 0x02; use constant EXECUTE_PERM => 0x01; use constant NO_PERM => 0x00; my $allowed_perms = READ_PERM | WRITE_PERM; # Check for permissions: if ( $allowd_perms == NO_PERM ) { print "PERMISSION DENIED\n" exit -1; } if ( $allowed_perms & READ_PERM ) print "READ Allowed\n"; if ( $allowed_perms & WRITE_PERM ) print "WRITE Allowed"; if ( $allowed_perms & EXECUTE_PERM ) print "EXECUTE Allowd\n"; ...