in reply to The Anomalous each()
No, you've reached an incorrect conclusion. each() works just fine and you don't have to care about how some previous loop exited and whether it reached the end or not. If you call values() or keys() in void context just prior to your new loop, you've reset the iterator to the beginning. void context keys()/values() are extremely cheap operations. Just do it.
keys %data; while ( ... = each %data ) { ... }
Its dumb that a person has to know to use a call to keys() to reset the iterator. I don't like that at all.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: The Anomalous each()
by fletcher_the_dog (Friar) on Nov 18, 2005 at 20:13 UTC | |
by diotalevi (Canon) on Nov 18, 2005 at 20:15 UTC | |
by jdhedden (Deacon) on Nov 18, 2005 at 20:39 UTC | |
by Fairy Nuff (Novice) on Nov 18, 2005 at 20:43 UTC | |
|
Re^2: The Anomalous each()
by jdhedden (Deacon) on Nov 18, 2005 at 20:19 UTC | |
by diotalevi (Canon) on Nov 18, 2005 at 20:28 UTC | |
by jdhedden (Deacon) on Nov 18, 2005 at 20:54 UTC |