in reply to How to find and remove duplicate elements from an array?

A solution that uses Tie::IxHash, a tie-able which preserves the keys of a hash in the order in which they were added:
use Tie::IxHash; sub removeDuplicates { tie my %tempHash, 'Tie::IxHash'; $tempHash{$_}++ for @_; keys %tempHash; } # Remove repeated elements from an array my @array1 = qw( 4 3 7 4 3 8 9 12 23 43 23 12 ); my @uniqArray = removeDuplicates( @array1 ); print "@uniqArray";