On Tue, 9 Oct 2001, stephen noble wrote:

>
>    my @pmRules = ();
>    foreach (sort keys %dungog)
>    {
>      push (@pmRules, $_)
>      if (db_get_type(\%dungog, $_) eq "$acctName");
>    }
>
> is a fragment of perl code used frequently in panel functions
> that extracts keys form a hash and sorts them
>
> i have keys i want sorted numerically but they are sorted
> ascii-betically. ie 124 comes before 2

Try:

foreach (sort { $a <=> $b } keys %dungog)
{
}

Charlie Brady                         [EMAIL PROTECTED]
Lead Product Developer
Network Server Solutions Group        http://www.e-smith.com/
Mitel Networks Corporation            http://www.mitel.com/
Phone: +1 (613) 368 4376 or 564 8000  Fax: +1 (613) 564 7739



--
Please report bugs to [EMAIL PROTECTED]
Please mail [EMAIL PROTECTED] (only) to discuss security issues
Support for registered customers and partners to [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Archives by mail and http://www.mail-archive.com/devinfo%40lists.e-smith.org

Reply via email to