Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: To Hash or to Array--Uniqueness is the question.

by kbrint (Sexton)
on Dec 02, 2005 at 08:47 UTC ( #513535=note: print w/replies, xml ) Need Help??


in reply to To Hash or to Array--Uniqueness is the question.

my (@items, @unique, %seen); for (@items) { push @unique, $_ unless $seen{$_}++; }
This has a few benefits:
  • Deterministic ordering.
  • Works for objects and passes them through to @unique without stringification.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://513535]
help
Chatterbox?
[marto]: code you write/port that runs via the terminal?
[robby_dobby]: guess I have to take a look at it off-work. I don't understand what those words mean, honestly :-)
[Corion]: Oooh. Tinc really looks good. It seems that it could even be used to link up (a segment of) my home network with (a segment of) a friends network, to create a private network over the internet
[marto]: fun times :)

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (12)
As of 2018-01-17 14:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (201 votes). Check out past polls.

    Notices?