use strict;my @a={"a","b","c"};my @b={"a","d","e","f"};foreach my $a(@a){ foreach my $b(@b) { if($a=~ m/$b/) { print "$a\n"; } }}这个程序该怎么改
少侠,你的数组定义有问题,应该是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"; } }}