Top Nav

Perl – Sort associative array by value

Here’s an alpha sort of the values of the associative array named “myarray”:

And here’s the same sort numerically:

And if you want numeric descending:

Of course don’t forget how to sort keys:

And a numerical sort of keys:

Email
Print