sub remove_dups { my %hash; $hash{$_}++ for @_; return keys %hash; } @ary = remove_dups( @ary )