Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Use Hash? Array? Still confused after all these years.

by chas (Priest)
on Jul 21, 2005 at 19:46 UTC ( #476977=note: print w/ replies, xml ) Need Help??


in reply to Use Hash? Array? Still confused after all these years.

The trouble with arrays for your example is that arrays are indexed by non-negative integers, while you really probably want to index by state. If you define arrays @states and @files where $state[$i] and $file[$i] correspond for each $i, you can likely use this for writing your data, but if you want to lookup the filename by state, then you'll have to iterate thru the whole @states array to find the index ... which is, at best, awkward.
chas
(Update: I guess someone already said this while I was responding...)


Comment on Re: Use Hash? Array? Still confused after all these years.
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (11)
As of 2014-09-30 13:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (372 votes), past polls