Michael G Schwern writes: > > C<reset %hash> should reset the hash iterator, instead of calling > > C<keys> or C<values> as is currently the case. > > Sounds good, except the name. reset() already does something. > Currently, reset() is for clearing large swaths of global variables (a > dubious feature) and for reseting ?pattern? searches. Two weird > features crammed into one keyword. Shoving a third in doesn't seem > pleasent. > > Either think up a better keyword, or remove those two crufty features. I was expecting those two crufty features to be removed. If they aren't, a third won't hurt. > > This would be equivalent to: > > > > foreach ($k,$v) (map { $_ => $hash{$_} > > sort > > keys %hash) > > { ... } > > What you proposed and what you put in your example doesn't quite play > out. C<sort keys %hash> returns just the sorted keys of %hash, but > your foreach example implies that both keys and values would be > returned, sorted by key. Both would be useful. That's what the map is for. (modulo syntax error in the map :-) NatThread Previous | Thread Next