Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Best practices for passing in function arguments?by andrewkl (Novice) |
on Dec 09, 2015 at 19:31 UTC ( [id://1149817]=perlquestion: print w/replies, xml ) | Need Help?? |
andrewkl has asked for the wisdom of the Perl Monks concerning the following question:
Hi, Can someone please tell me which scenario is the best practice in terms of passing args to a function? In Scenario 1, foo() calls bar() with a reference to an array that contains only 1 item (that item is a ref to a hash). In Scenario 2, foo() calls bar() with a reference to a hash array. Does it make sense to pass in an array that contains only one item (a ref to a hash)? That array will always have only 1 item. Or is it better to directly pass in the hash array (Scenario 2) ? Thanks --Andrew /////////////////////////////////////////////////////////// #### Scenario 1: //////////////////////////////////////////////////////////////////////////// #### Scenario 2:
Back to
Seekers of Perl Wisdom
|
|