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

Re: Checking if an item exists in an array before adding a record to it.

by Happy-the-monk (Abbot)
on Aug 10, 2013 at 15:19 UTC ( #1048911=note: print w/replies, xml ) Need Help??


in reply to Checking if an item exists in an array before adding a record to it.

I suspect using grep would be even slower.

  • either use grep on the array if you want to check if something's already in it as you suggest yourself
  • or throw the dupes out when you are done populating the array (if order does not matter)
  • or (again if order does not matter) use a hash all the way through and use keys %hash to get a list of unique entries instead of the array.

Cheers, Sören

Créateur des bugs mobiles - let loose once, run everywhere.
(hooked on the Perl Programming language)

  • Comment on Re: Checking if an item exists in an array before adding a record to it.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1048911]
help
Chatterbox?
[Lady_Aleena]: Well, right now, I"m looking at modules where I put randomness that aren't in my RolePlaying/Random dir, like RolePlaying:: Character:: Alignment that is mostly about random_alignment than expand_alignment.
[erix]: cute
[Lady_Aleena]: So, I'm thinking about splitting it between the two different things.

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2017-05-27 20:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?