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

luxs has asked for the wisdom of the Perl Monks concerning the following question:

I do need to do few nested iterations through hash and they are not working properly (thertically i do understand why).
my $h = {'a'=>1, 'b'=>2, 'c'=>3, 'd'=>4,}; while( my ($k1, $v1) = each(%$h)) { say "external $k1 => $v1"; while( my ($k2, $v2) = each(%$h)) { say "internal $k2 => $v2"; } }
But what is the best practical solution for this task? 1. use dclone to have two hash copies - good when they are not huge 2. use array with proper indexing instead of hash