in reply to Removing Duplicates from Array Passed by Reference

If you want to keep the order and edit in place, try this:
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";
OUTPUT:
a b c a j k l m o p q k a b c j k l m o p q