in reply to Re: Re: Re: Re: 3D array of hashes
in thread 3D array of hashes

Given the above snippets you provided, you would do this:
foreach $date ( @weather_days ) { $weather_archive{$date->{Year}}{$date->{Month}}{$date->{Day}} = ( $date->{High}, $date->{Low}, $date->{Season}, $date->{Wind}, $date->{Bar} ); }
For that to work right, you need to not be pushing %hash onto @array (that will flatten hash into a list) but rather push @array, {%hash}; (push an anonymous hash reference).

I'm sure that my snippet can be done with a map too but this is good enough. Oh, and that's the part that perlreftut would give you a better grasp on. Go ahead and read perlreftut and perlref as mentioned earlier so that you won't flunk the exam at the end of the semester. Producing working code today, and understanding the concepts behind it are two different things. This is something that you will use a lot once you understand the concepts. Failing to dig until the concept sinks in is going to cripple your progress.


Dave


"If I had my life to do over again, I'd be a plumber." -- Albert Einstein