@anew = shrink(\@a, \@b); sub shrink { my %seen; my @ret; warn ("input arrays not the same length") unless scalar @{$_[0]} == scalar @{$_[1]}; for my $i ( 0..scalar @{$_[1]} ) { push @ret, $_[0]->[$i] unless $seen{$_[1]->[$i]}; $seen{$_[1]->[$i]} = 1; } return @ret; }
In reply to Re: delete multiple occurrences
by holli
in thread delete multiple occurrences
by coldy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |