少侠,你的数组定义有问题,应该是y @a=("a","b","c");和@b=("a","d","e","f");其他的好像没什么问题望采纳具体代码如下:use strict;my @a=("a","b","c");my @b=("a","d","e","f");print "@a\n";foreach my $a(@a){ foreach my $b(@b) { if($a eq $b) { print "$a\n"; } }}