Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: How do I find if an array has duplicate elements, if so discard it?

by hossman (Prior)
on May 30, 2003 at 00:22 UTC ( [id://261732]=note: print w/replies, xml ) Need Help??


in reply to How do I find if an array has duplicate elements, if so discard it?

A one-liner from "Effective Perl Programming"...

@uniq = sort keys %{ { map { $_, 1 } @list } };
  • Comment on Re: How do I find if an array has duplicate elements, if so discard it?
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2024-04-23 14:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found