-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



You're right, I should've read more carefully.

- -----Original Message-----
From: Philip Newton [mailto:[EMAIL PROTECTED]]
Sent: May 10, 2000 11:23
To: 'Andrew Bastien'; Perl-Win32-Users Mailing List
Subject: Re: sorting hash


Andrew Bastien wrote:
> In the spirit of TIMTOWDI, you can also do:
> 
> sort {$thehash{$a} <=> $thehash{$b}} keys %thehash

This does something else -- it sorts the hash keys according to the values,
using numeric comparison. This only works correctly if all the values are
numbers. And besides, the original poster specified the hash be sorted by
key, not by value. Hope this helps.

Cheers,
Philip

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.2 for non-commercial use <http://www.pgp.com>

iQA/AwUBORmAgT1j58pgs53KEQIFGACfdOc0Ik136s7FkMtCU82uKl/2ymAAoM2y
2qaW6ehkVlLp5xT0mI9AGpLH
=RIp5
-----END PGP SIGNATURE-----

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to