XP is just a number | |
PerlMonks |
Re^3: multiple layers of referencing and dereferencingby Herkum (Parson) |
on Jun 23, 2009 at 15:28 UTC ( [id://774062]=note: print w/replies, xml ) | Need Help?? |
The advice I would give you then is that hashes are for context and arrays are for order. Things that you don't need to know the order of should be in some sort of hash because the keys of a hash give the data context. Example:
The first example with a bad data structure requires explicit know of the exact order of your arguments to know where cats and dogs are. In addition if you just deference the data you still don't necessary know what you are working with. Don't do it. The second example explicitly designates which array references go with what type of data. Your funtion() will need to deference the data via a name which puts your code into a context which makes it easier to understand.
Hope this helps.
In Section
Seekers of Perl Wisdom
|
|