weezer_316 has asked for the wisdom of the Perl Monks concerning the following question:
Hi
I am having some trouble with hashes with a package I am writing for my company which deals with dental patients.
Basically, I have code like the sample below with patients details,thing like name, address, dob etc in the an array of hashes
Now, what I want to do is loop through each patient in turn and add the patient to a new hash key'd on thier dentists surgery ID.
$practice = {}; foreach $patient(@{$self->{patient_details}}) { $practice->{$patient->{suregery_id}} = \$patient; }
In theory, I should group all the patients with a surgery ID of 1, 2, 3 etc togther. However it isnt working. I have tried puting them in arrays, new hashes, sub routines passing back a hash, but i still cant get them all groupped together
Any ideas how I could do it?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: In a hash with hashes
by BrowserUk (Patriarch) on Jan 10, 2010 at 13:23 UTC | |
by AnomalousMonk (Archbishop) on Jan 10, 2010 at 21:57 UTC | |
by weezer_316 (Novice) on Jan 10, 2010 at 13:56 UTC | |
|
Re: In a hash with hashes
by apl (Monsignor) on Jan 10, 2010 at 13:36 UTC | |
by weezer_316 (Novice) on Jan 10, 2010 at 14:11 UTC |