loris has asked for the wisdom of the Perl Monks concerning the following question:
Here's the problem:
I have an array of objects, let's say Monks. I want to sort them into groups, let's say according to Level, and then call a subroutine, e.g. callToPrayer, which takes an array of monks as its argument, on each group individually. What would be the easiest/most elegant way grouping the monks?
I have had a look at the chapter in the Perl Cookbook about Hashes with Multiple Values Per Key, but I wondered if there was another way without using references.
I would be very grateful for any advice.
loris
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Grouping Objects by Attribute
by edan (Curate) on Nov 01, 2004 at 09:02 UTC | |
by loris (Hermit) on Nov 01, 2004 at 09:47 UTC | |
by edan (Curate) on Nov 01, 2004 at 10:14 UTC | |
|
Re: Grouping Objects by Attribute
by TedPride (Priest) on Nov 01, 2004 at 09:20 UTC | |
|
Re: Grouping Objects by Attribute
by dragonchild (Archbishop) on Nov 01, 2004 at 13:39 UTC | |
|
Re: Grouping Objects by Attribute
by Anonymous Monk on Nov 01, 2004 at 10:33 UTC |