in reply to Re: Best practices for passing in function arguments?
in thread Best practices for passing in function arguments?

Hi,
I guess my question is: 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
  • Comment on Re^2: Best practices for passing in function arguments?

Replies are listed 'Best First'.
Re^3: Best practices for passing in function arguments?
by GotToBTru (Prior) on Dec 09, 2015 at 19:44 UTC

    Will the subroutine ever be expected to perform its task on a list of hashes? Then an array would make sense. Otherwise it seems a needless complication. Which is repeating what I said before. It's your subroutine; YOU figure out how you want to use it.

    Dum Spiro Spero
      Hi,
      The processing of the list of hashes is handled in bar(), not foo().
      I think scenario 2 is makes more sense, but just wanted to see what others think.
      Thanks
      --Andrew