Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Finding unique elements in an array

by pelagic (Priest)
on Mar 15, 2005 at 13:28 UTC ( [id://439619]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use Benchmark;
    
    ...
     grep_seen:     15 wallclock secs (14.86 usr +  0.01 sys = 14.87 CPU) 
    +@ 67.23/s (n=1000)
    keys_map_1:     50 wallclock secs (46.78 usr +  0.83 sys = 47.61 CPU) 
    +@ 21.00/s (n=1000)
    keys_map_undef: 43 wallclock secs (42.16 usr +  0.94 sys = 43.09 CPU) 
    +@ 23.21/s (n=1000)
    
  2. or download this
    my @b = map {$a[$_] eq $a[$_ + 1] ? () : $a[$_]} 0..$#a;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-03-28 08:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found