Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: finding the distinct elements in an array

by johndageek (Hermit)
on May 29, 2006 at 22:11 UTC ( [id://552379]=note: print w/replies, xml ) Need Help??


in reply to finding the distinct elements in an array

## manual solution
my @a = ( 1..3, 2..3, 6, 8..9); my $last_element = ""; my @sorted_aray = sort(@a); foreach $i (@aorted_array){ if ($last_element ne $i){ print $i; $last_element = $i; } }

Enjoy!
Dageek

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2025-06-25 08:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.