http://www.perlmonks.org?node_id=814250


in reply to selectall_hashref structure

I'm not sure about what you want to do, but I hope this helps:

#!perl use strict; use warnings; use Data::Dumper; my $id = '1C8962EB'; myfunction($id, { max => 90, cval => 89 }); sub myfunction { my %p = %{$_[1]}; print Dumper(\%p); my %newp = map { $_ => { value => $p{$_}, key => $_, id => $_[0] } + } keys %p; print Dumper(\%newp); } __END__ $VAR1 = { 'max' => 90, 'cval' => 89 }; $VAR1 = { 'cval' => { 'value' => 89, 'id' => '1C8962EB', 'key' => 'cval' }, 'max' => { 'value' => 90, 'id' => '1C8962EB', 'key' => 'max' } };