in reply to Sending an anonymous hash to a sub
This "flattens" the first argument of the sub if it is a hash reference. Thus, if you call describe( { some=>'args' }, more => 'of_them' ), you'll get %person=(some=>'args',more=>'of_them'); Please note that the ordinary arguments overwrite those of the flattened hash in case of matching keys.sub describe { my %person; if (@_ and ref($_[0]) eq 'HASH') { %person = %{+shift}; } %person = @_; ... }
|
|---|