Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Don't use an array, use a hash reference. It will be so much easier. Take this example,
If you use an array, you are dependent on the order of the array to pass the arguments. Switches you would not need, you have to include a value for them anyways just to make sure the array is the correct structure. It becomes easy to miss a value and you will spend alot of time trying to identify what is the problem. In addition, none of the values are descriptive so you have no idea what they mean just by looking at them. If you have to go back, you may forget the order and someone else who needs to change it will have a hard time trying to figure it out. Using a hash reference makes it easier to read and add switches.
The next person who comes along at least has a chance of identifying the values and what they are supposed to used for. In reply to Re: Storing multiple arguments in a data structure that allows for future expansion
by Herkum
|
|