@x = qw(6); @y = qw(1 2 3 4); foreach $x (@x) { any{$x == $_ } @y ? push(@z, "y") : push(@z, "n"); }