Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: array of hashes, categorized by array index

by sundialsvc4 (Abbot)
on Jun 26, 2013 at 23:58 UTC ( #1040869=note: print w/replies, xml ) Need Help??

in reply to array of hashes, categorized by array index

Usually, when faced with requirements like these, I grab the various “columns” into hash buckets, just so that I can easily refer to them by name.   (I also use use constant to define those names in the code.)

Then, when it comes time to actually generate an array out of the thing, I simply iterate through a qw// list of those strings, so that it is the order of the entries in this list (effortlessly changed to suit the present whim of the marketing department ...) that defines the column-order.   You can rearrange them to your heart’s content and nothing else happens throughout the code.

By contrast, if you try to use actual array-indices ... well, the day will come when the third change of the day happens and “you miss just one of them ...”

  • Comment on Re: array of hashes, categorized by array index

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1040869]
NodeReaper hides the Vote Fairy's wand

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2018-01-21 10:42 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (227 votes). Check out past polls.