in reply to Removing Duplicates from Array Passed by Reference
OUTPUT:sub util_remove_duplicates{ my $ref=shift; my %hash; @$ref=grep{!$hash{$_}++} @$ref; } my @array=qw(a b c a j k l m o p q k); print "@array\n"; util_remove_duplicates(\@array); print "@array\n";
a b c a j k l m o p q k a b c j k l m o p q
|
|---|