Duplicated elements can be removed by using them as hash keys,
or by sorting and testing successive elements. If order is important, you must decide whether you want the first or last occurrance. Then you can construct a second array by pushing on elements which haven't been seen yet, $hash{$_}++ or push @unique, $_ for @array;@hash{@array) = (); @array = keys %hash;
After Compline,
Zaxo
In reply to Re: Removing an element from an array
by Zaxo
in thread Removing an element from an array
by sonic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |