in reply to Re^2: Looping through a hash where some keys are the same
in thread Looping through a hash where some keys are the same

I'll look into those options. As for what the objective is... it's a script that scours an auction site I frequent b/c their alert system sucks so bad. My hash looks like

"searchstring" => "section",

There are some (very few) items that I would want to search for in different sub sections. For now, they're all in the same main section, so I just search that, but it gets like 300 hits or so each day... about half of it crap I don't want to see.

I assume the smartest approach would to make the keys of the hash the section to search, and the value an array holding the different strings I want to search in that section, no? It'd take a fair bit of rewriting. Not sure if it's worth it at this point, but would be do-able.
  • Comment on Re^3: Looping through a hash where some keys are the same

Replies are listed 'Best First'.
Re^4: Looping through a hash where some keys are the same
by tphyahoo (Vicar) on Feb 18, 2005 at 11:17 UTC
    The value could be an arrayref, as you say, or it could be a hashref. Advantage of a hash ref is you don't have to check for duplicates, since duplicates aren't allowed in a hash. Personally I use hashes a lot more than arrays.