Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by perladdict (Chaplain)
on May 11, 2006 at 05:13 UTC ( [id://548644]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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

hi monk,

i am beginar to perl,i tried to remove the duplicates from a one dimentional array.Here is my code

#!/usr/bin/perl -w @a=(1,2,3,4,5,5,6,3,7); undef %raw; @b=grep(!$raw{$_}++,@a); print "@b \n";

Originally posted as a Categorized Answer.

  • 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://548644]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.