push @z, (grep { $_ ~~ \@y } @x) ? 'y' : 'n'; #### sub arrays_intersect { grep { $_ ~~ $_[1] } @{$_[0]} } push @z, arrays_intersect(\@x, \@y) ? 'y' : 'n'; #### my $x_set = Set::Scalar->new(@x); my $y_set = Set::Scalar->new(@y); push @z, $x_set->intersection($y_set)->empty ? 'n' : 'y';