in reply to Re: passing subroutine args as a hash: why not?
in thread passing subroutine args as a hash: why not?
If one key gets misspelled, it can create an ugly bug that is hard to find.
This is one of the best reasons to use named parameters! Within your subroutine you can match the names you received against a list of names you expected to receive and you know immediately what's missing. You can also wrap the arguments in a temporary parameter object that automatically does the argument checking for you.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: passing subroutine args as a hash: why not?
by Anonymous Monk on Jun 06, 2003 at 17:36 UTC |