标签:style c class blog code java
my @a=("a","b","c","d","e"); my @b=("b","g","f","e"); my %a=map{$_=>1} @a; my %b=map{$_=>1} @b; # 交集 @A = grep( $a{$_}, @b ) ; # 补集 @B1=grep(!defined $a{$_}, @b); @B2=grep(!defined $b{$_}, @a); # 并集 %C=map {$_=>1} @a,@b; @C=keys %C;
Perl 数组 交集,补集,并集,布布扣,bubuko.com
标签:style c class blog code java
原文地址:http://www.cnblogs.com/xufeiyang/p/3747628.html