Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 musing on the Monastery: (5)
As of 2024-09-15 13:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (21 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.