# Setup my @ok; ++$ok[$_] for 1, 2, 3; # Sample usage if ($ok[$variable]) { ... }