On Thu, 9 Mar 2006, Ron Smith wrote:

> How can I assure printing the correct order?

You can't guarantee the order of keys in a hash per se. For efficiency 
and optimization, hashes are stored in a random order, unlike arrays, 
which do have a straightforward order.

The trick then is to sort the hash keys. Instead of this:
 
> foreach ( keys( %values ) ) {

Try this, or a variant on this:

  foreach ( sort keys( %values ) ) {

You can get more sophisticated than this, but doing at least this much 
sorting on the keys should start producing consistent results.


-- 
Chris Devers
DO NOT LEAVE IT IS NOT REAL

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to