|
发表于 2006-2-14 09:38:05
|
显示全部楼层
哇,2002年的贴子啊,我来perl的
#! /usr/bin/perl
my @a=qw/a b c d e/;
my @b=qw/a f c g w e/;
my (@c,@d); # c 表示共有的,d表示a有b没有
foreach my $item (@a) {
push(@c,$item) if grep /^$item$/,@b;
push(@d,$item) if grep !/^$item$/,@b;
}
print "@c\n";
print "@d\n"; |
|