SPUG: Another stupid question, hash sorting
Thomas Whitney
whitneyt at agcs.com
Tue Jul 2 18:53:47 CDT 2002
It depends how your hash is set up.
is it:
$score = $hash{$name}
or
$score = $hash{$name}{score}
or
$name = $array[$index]{name}
$score = $array[$index]{score}
etc...
Thanks
Tom
Peter Darley wrote:
> Friends,
> I've got another stupid question that I'm hoping someone can answer for me.
> I want to sort a hash on two values, and have been unsuccessful in my search
> of the web for info on how to do it.
> Specifically I have a hash containing {Score} and {Name} values, and I want
> to primarily sort on score, and sort on name where the score is the same. I
> can do this with a two step sort, but I figured that Perl was probably cool
> enough to provide a simple way of tackling this.
> Thanks,
> Peter Darley
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
> Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
> Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
> For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
> Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
More information about the spug-list
mailing list