whatever(%hash, $val) ... sub whatever { my $v = pop; my %h = @_; # %hash was expanded into list of key-value pairs # reconstruct hash from array of key-value pairs ... }