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

Re: array of hashes, categorized by array index

by sundialsvc4 (Monsignor)
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2014-08-22 13:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (158 votes), past polls