Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Create unique array --the hard way!

by kcott (Archbishop)
on Mar 07, 2014 at 21:11 UTC ( [id://1077457]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/env perl -l
    
    ...
    my $last = '';
    my @unique = map { $last eq $_ ? () : ($last = $_) } sort @initial;
    print "Unique:  @unique";
    
  2. or download this
    Initial: q w e r t y q w e r t y
    Unique:  e q r t w y
    
  3. or download this
    #!/usr/bin/env perl -l
    
    ...
    __DATA__
    I am supposed to create a unique array
    I am not supposed to use hashes
    
  4. or download this
    Unique:  I a am array create hashes not supposed to unique use
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-18 01:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found