Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2016-09-25 01:37 GMT
Find Nodes?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:

    Results (463 votes). Check out past polls.