sub common_subset { my $a = shift; @_ or return @$a; my %h; @h{@$a} = (); grep { exists $h{$_} } common_subset( @_ ) }