use Quantum::Superpositions; my $x = all(any(1,4),any(1,4)); #also: all(any(1,4),any(1,4)) if($x == all(1,4)){ print "Solved\n"; }