in reply to Advantages to passing a hash to a subroutine?

Not only can you pass them in any order with a hash, but you can omit any number of arguments without ugly commas and empty quotes (if you were trying to preserve position):
foo('','','',123); # array

Another advantage is that the arguments are self-documenting with a hash.

Also consider passing your hash by reference.

Replies are listed 'Best First'.
Re^2: Advantages to passing a hash to a subroutine?
by alliswell (Novice) on Jun 18, 2012 at 21:10 UTC

    Thank you toolic

    Can you give an example on how the arguments are self-documenting as compared to not using a hash?

    Thank you!

      I think I see the example of the self-documenting hash from tobyinc. It makes it more clear.

      perform_wedding( official => $smith, wife => $jones, husband => $brown, );