P is for Practical | |
PerlMonks |
Re: How do I find if an array has duplicate elements, if so discard it?by rjimlad (Acolyte) |
on Jul 19, 2002 at 20:18 UTC ( [id://183435]=note: print w/replies, xml ) | Need Help?? |
Err, okay, my answer, short and sweet: use a hash and array slices:
Of course, in this instance you don't want the last line - instead you'd probably want something like: ...which will be out-of-order, but guaranteed duplicate free.
In Section
Seekers of Perl Wisdom
|
|