Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2017-03-30 10:12 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (356 votes). Check out past polls.