Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Re: (jeffa) Re: Removing Duplicates in an array?

by davorg (Chancellor)
on Jun 26, 2001 at 17:53 UTC ( [id://91588]=note: print w/replies, xml ) Need Help??


in reply to Re: (jeffa) Re: Removing Duplicates in an array?
in thread Removing Duplicates in an array?

Something like this I guess:

my @list = qw(fish bread eggs eggs fish butter); my %check; $check{$_}++ foreach @list; my @unique = grep { $check{$_} == 1 } keys %check;

But I'm not much of a golfer :)

--
<http://www.dave.org.uk>

Perl Training in the UK <http://www.iterative-software.com>

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-28 20:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found