|There's more than one way to do things|
Remove duplicate strings from an arrayby Anonymous Monk
|on Mar 13, 2007 at 14:40 UTC||Need Help??|
Anonymous Monk has asked for the
wisdom of the Perl Monks concerning the following question:
OK, maybe im looking in the wrong places or something, I found loads on removing duplicates from arrays but the examples they gave only seemed to work for integers.
One solution is to pop off each element of the array and compare it against every other element remaining. If there's a match, chuck it, otherwise it must be unique so add it to @output. Surely there's a more efficient perlesque way though?
So the idea is if I have an array:
The output should be:
Can someone offer a Perl newbie a hand?!
Also can anyone suggest other good sites I can draw code samples/tutorials/information from?