-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
In the spirit of TIMTOWDI, you can also do:
sort {$thehash{$a} <=> $thehash{$b}} keys %thehash
- -----Original Message-----
From: Ned Konz [mailto:[EMAIL PROTECTED]]
Sent: May 10, 2000 11:02
To: Perl-Win32-Users Mailing List
Cc: Perl-Win32-Users Mailing List
Subject: Re: sorting hash
byron wise wrote:
>
> I have a hash that needs to be sorted acording to the keys. Then put the
> values in an array. Will the following work?
>
> @sorted = sort keys %thehash;
no. That gives you the sorted keys, not the values. Use this:
@sorted = map { $thehash{ $_ } } sort(keys(%thehash))
- --
Ned Konz
currently: Stanwood, WA
email: [EMAIL PROTECTED]
homepage: http://www.bike-nomad.com
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.2 for non-commercial use <http://www.pgp.com>
iQA/AwUBORl+Nz1j58pgs53KEQIfegCg1NVTYoms8HU9TSPb43Z4a2Zb3y4An1dr
4KZWNTVYKgIX7Djtf0SJ1tfN
=CoZ9
-----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]