You can do it like this using a hash:
sub remove_dups { my %hash; $hash{$_}++ for @_; return keys %hash; } @ary = remove_dups( @ary )
This is a very common question. In fact it was asked yesterday - have a look at my answer at Re: A C-like brain in a Perl-like world - particularly the bit about the Perl FAQs - they will save you heaps of time. Virtually every common problem is covered in the FAQs so they are well worth a look.
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Removing Duplicate Array Elements!!!
by tachyon
in thread Removing Duplicate Array Elements!!!
by dnickel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |