Lightning flashed, thunder crashed and Jeffl <[EMAIL PROTECTED]> whispere
d:
| when you run a foreach on a hash you have no idea what order you will get
| the keys unless
| you sort it, then you can only get it in the order defined by sort. If you
| use Tie::IxHash
| on a hash you can print out the has in the order it was constructed.
That isn't true. A hash will always return in a predictable order. *You*
may not be able to predict it, but the interpreter can. It walks the hash
tree, so unless the hash tree changes (you insert/delete elements), it will
always return the same results.
| pg.118) "There is no way with foreach to tell where you are in a list. You
| may compare adjacent elements by remembering the perevious one in a
| variable, but sometimes you just have to break down and write a three-part
| for loop with subscripts."
Again, what you are saying is not true. There is no way to have foreach
tell you what element you are on, although it is possible to find it out
indirectly. It will, however, always walk the array by going from memory
location to memory location, so it will always traverse it in the same
order.
-spp
--
Stephen P Potter Columbus, Ohio, USA [EMAIL PROTECTED]
"You can't just magically invoke Larry and expect that to prove your point.
Or prove that you have a point." -Simon Cozens
UNIX, Perl, PHP, Web Consulting and Training http://www.unixlabs.net/~spp/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]