my @chain = qw/a b c d/; my %hash; sub foo(\%@){ local $_ = shift; $_ = $_->{scalar shift} = {} while @_; } foo %hash => @chain;