I'm working on upgrading a calendar for my company. We currently build a hash of a hash which holds an array. For example:
push(@{$events{$datestamp}{"event_num"}},$event_num);
and reference as:
${$events{$datestamp}{"event_num"}}[$x]
The datestamp holds the date of the event, and the event number is the unique identifier. There could be more than one "event_num" per day, hence the array in the hash.
Now, we need to expand it so that we can build a hash which first holds the different calendars (the number for each request is dynamic, so I can't declare a fixed number of variables). The "key" being the identifier for which calendar's data we want to access. Then, depending on the calendar, accesses the hash example above.
I've tried building it like:
$other_cals{$cal_X} = %events;
Is this correct and/or possible? If so, how do I then reference the data? I cannot seem to extract anything.
I've tried stuff like:
${$other_cals{"demo2"}{${$events{$datestamp}{"event_num"}}[0]}}
$other_cals{"demo2"}{$events{$datestamp}{"event_num"}}[0]
And so on. I know there's data being read because when I print:
${$events{$datestamp}{"event_num"}}[0]
I receive values.
Thanks!
push(@{$events{$datestamp}{"event_num"}},$event_num);
and reference as:
${$events{$datestamp}{"event_num"}}[$x]
The datestamp holds the date of the event, and the event number is the unique identifier. There could be more than one "event_num" per day, hence the array in the hash.
Now, we need to expand it so that we can build a hash which first holds the different calendars (the number for each request is dynamic, so I can't declare a fixed number of variables). The "key" being the identifier for which calendar's data we want to access. Then, depending on the calendar, accesses the hash example above.
I've tried building it like:
$other_cals{$cal_X} = %events;
Is this correct and/or possible? If so, how do I then reference the data? I cannot seem to extract anything.
I've tried stuff like:
${$other_cals{"demo2"}{${$events{$datestamp}{"event_num"}}[0]}}
$other_cals{"demo2"}{$events{$datestamp}{"event_num"}}[0]
And so on. I know there's data being read because when I print:
${$events{$datestamp}{"event_num"}}[0]
I receive values.
Thanks!