Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: How can I display a unique array if it contains some repeated elements

by tadman (Prior)
on Jun 07, 2002 at 20:31 UTC ( [id://172660]=note: print w/replies, xml ) Need Help??


in reply to How can I display a unique array if it contains some repeated elements

There is a similar technique which is slightly faster (~5-7%) on larger lists:
my %h; grep { !$h{$_}++ } @list;
The answer by dvergin is actually about 50% faster for lists smaller than ~2000 items.
  • Comment on Re: How can I display a unique array if it contains some repeated elements
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://172660]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2025-06-22 14:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.