The thing is, if you know which keys you want to process,
and you want them in a specific order, there is no reason to
use keys in the first place. Just give the keys in an array,
as others have suggested, and index into the hash using them.
keys is useful for getting all the keys in a hash, precisely
so that you don't have to know their values in advance.
--ZZamboni
| [reply] |
yeah i realize that now.. keys isn't really useful here.. but hey i wrote this script after maybe 2 or 3 weeks of teaching myself perl and now having had 2 whole months of experience i actually have learned a few things.. thanx :)
| [reply] |
is it not a valid practice to specify the keys you want
to print when looping through a hash like that?
No, unfortunately you can't specify the order that keys
will be returned, not using that method anyway. You can
either use the keys function and sort its return
value, or specify each of the keys in some other way, see
posts above for examples
Nuance
Baldrick, you wouldn't see a subtle plan if it painted
itself purple and danced naked on top of a harpsichord,
singing "Subtle plans are here again!" | [reply] |