Help for this page
for my $href ( @data ) { my $copy_ref = { %$href }; delete $copy_ref->{sex}; push @{ $data2->{$href->{sex}} }, $copy_ref; }
for my $href (@data) { push @{ $data3->{ $href->{sex} } }, { map 'sex' eq $_ ? () : ( $_ => $href->{$_} ), keys %$href } +; }