This is an archived low-energy page for bots and other anonmyous visitors.
Please sign up if you are a human and want to interact.
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...)
|