in reply to Re^4: Benifits of using hash rather than number of variables?
in thread Benifits of using hash rather than number of variables?
Since there's no reason to use the hash key more than once inside the subroutine, the protecting inside the subroutine is just overhead, adding absolutely nothing at all of value:
Alternatively, you can stick the key names in variables.sub whatever { my %params = @_; my $key1 = $params{key1}; my $key2 = $params{key2}; my $key3 = $params{key3}; ... neither %params, nor the key names are needed anymore ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Benifits of using hash rather than number of variables?
by duelafn (Parson) on Jul 21, 2011 at 15:27 UTC |