in reply to Re: Hash sorting
in thread Hash sorting
This is not a knee-jerk premature optimization; it is how I think of the loop. I believe that, as an idiom, while/each should be favored over foreach/keys when the key and value are both needed but the order of access does not matter.while ( my ($section,$v1) = each %$hash ) { while ( my ($item,$count) = each %$v1 ) { push @data, [$count, $section, $item]; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Hash sorting
by tilly (Archbishop) on May 13, 2003 at 15:38 UTC | |
|
Re^3: Hash sorting
by Aristotle (Chancellor) on May 13, 2003 at 14:06 UTC |