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 ( #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
Node Status?
node history
Node Type: note [id://439619]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2018-07-21 21:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (450 votes). Check out past polls.

    Notices?