Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: remove duplicate value in array

by Fletch (Bishop)
on Jul 11, 2006 at 13:46 UTC ( [id://560456]=note: print w/replies, xml ) Need Help??


in reply to remove duplicate value in array

When you want distinct values think hash.

my %seen; @content = grep !($seen{$_}++), split( / /, $content );

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-04-26 08:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found