I would assume from the data structure that the arrays might be intended to contain more than one value, although that has not been demonstrated in the code of the question.
My approach, keeping with the spirit of the push as I perceive it, is below. It's less ugly than what I thought it would be:
for my $row ( @hash{ @cols }) {
push @$row, shift @values
}
I also thought about an approach that does avoid the loop, but my solutions only shuffles the loop around, and doing weirdo aliasing tricks through @_ did not lead to a good solution for me - it seems that array-assigning to the aliased @_ does not do individual assignment to the slots:
sub alias { \@_ };
{
my %hash;
my @cols = qw(min max sum);
my @values = qw(1 3 4);
@{ alias map { $_->[ 0+ @$_ ] } @hash{ @cols } }= @values;
print Dumper \%hash;
}
Avoiding the magic aliasing and passing around references does not really improve the situation, even though it works.
{
my %hash;
my @cols = qw(min max sum);
my @values = qw(1 3 4);
for( map { \$_->[ 0+@$_ ] } @hash{ @cols } ) {
$$_= shift @values;
};
print Dumper \%hash;
}