The data structure that you use depends, in part, on what you are trying to accomplish. However, from your writeup, it seems that you have several different users/entities with basically the same information describing them. I assume the program then performs a set of standard operations on the data about these users/entitites one user at a time.
Given that, I would store the info about these users in a HoH or AoH. This data structure gives you the ability to access data about the users dynamically. Once a user is determined, you can store a reference to that users data structure into a generic hash and use that reference throughout the rest of the program. That way you don't have to try and code references to specific users elsewhere in the program.
my %users = (
george => {
total_money => "42",
max_money => "100"
},
lindsay => {
total_money => "125",
max_money => "1000"
},
};
my $userref = \$users{$userid};
# the rest of the program accesses $userref specifically ...
PJ
unspoken but ever present -- use strict; use warnings; use diagnostics; (if needed)