Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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 exploiting the Monastery: (3)
As of 2024-04-25 19:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found