in reply to How do I completely remove an element from an array?
my @items = qw ( 1 2 2 2 1 3 3 2 3 4 3 1 2 5 ); my $x, $y; $x = 0; foreach $a (@items) { $y = 0; foreach $b (@items) { if ($a == $b) { next; } if ($items[$x] == $items[$y]) { splice(@items, $y, 1); } $y++; } $x++; }
Originally posted as a Categorized Answer.
|
|---|