in reply to a hash with priority
You can assume the efficiency doesn't really matter as long as a, b, d, and e are "low" for some value of low.
If you have lots of lookups on priority, put priority first : $hash{$priority}->{$name} - you can use an array if you have a "continuous" list of priorities in this case: $array[$priority]->{$name}.
If you have lots of lookups on name you can put name first: $hash{$name}->{$priority}.
If you have lots of lookups on both name and priority and less "inserts" make 2 indexes: $names{$name}->{$priority} and $priorities{$priority}->{$name}.
If you only use 1 priority per name and vice versa, you can collapse them so it will be faster to look up:
# for named lookup $names{$name} = { priority => $priority, value => $value }; # for priority lookup $priorities{$priority} = { name => $name, value => $value };
As you can see, there are quite a lot of options.
note that, on Unix, setting ENV will only affect programs exec'd from the current program (including system(), backticks etc.), NOT the "calling" environment (shell).
Updated: slightly better list layout
|
|---|