in reply to Error in code - read-only value?
sort returns a sorted list, so
sort {$a->{ID} <=> $b->{ID} } @all_hashes
(without the assignment) should be sufficient.
Not: Grossly uninformed post here. You'd want to say
@sorted_all_hashes = sort {$a->{ID} <=> $b->{ID}} @all_hashes
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Error in code - read-only value?
by katgirl (Hermit) on Sep 23, 2003 at 13:59 UTC | |
But now it's sorting the keys in text order (1 - 100 - 101 - 2 - 21 etc) and when I click on the links to change the sorted by order, it still comes out sorted by ID. | [reply] [Watch: Dir/Any] [d/l] |
by Mr. Muskrat (Canon) on Sep 23, 2003 at 14:17 UTC | |
I've made a few changes
Update: You didn't have an 'average' or a 'hits' key in the hash so I did a search and replace and this what I ended up with. Update 2: Now strict compliant. Update 3: No more read-only value errors :-) | [reply] [Watch: Dir/Any] [d/l] |
In Section
Seekers of Perl Wisdom