The reason why is because if we solve your problem, we are just treating the symtom - not the real problem. I have a good feeling you are doing far too much work . . .
The only other advice i can give is style pointers on your code. First off the INPUT hash could be initiated like so:
And you can populate your first two keys in the STUDQT hash like so:my %INPUT = ( quizes => 2, assign => 2, recit => 2, ndays => 1, AT32000011 => 1, QZ132000011 => 1, RI132000011 => 1, AS132000011 => 1, QZ232000011 => 2, RI232000011 => 2, AS232000011 => 2, AT32000012 => 1, QZ132000012 => 12, RI132000012 => 12, AS132000012 => 12, QZ232000012 => 22, RI232000012 => 22, AS232000012 => 22, );
But, $STUDQT{'32000011'}[1]['01'] = '0'; is just wrong, wrong, wrong! What are you trying to do here? Well, you are obviously trying to initalize that value, but why do you need hash of lists of hashes? My first impression is that you meant to say $STUDQT{'32000011'}[1]{'01'} = 0;, but that doesn't make sense either. . .foreach (32000011..32000012) { push @{$STUDQT{$_}}, qw(fname mname lname Sex); }
Please use Data::Dumper when dealing with complex data structures like %STUDQT, here is what it looks like after the last initialization line:
as you can see, '01', '02', etc are not there, meaning that those 8 lines of code that 'define' them are uneccesary.use Data::Dumper; print Dumper \%STUDQT; #yields: $VAR1 = { '32000011' => [ 'fname', 'mname', 'lname', 'Sex' ], '32000012' => [ 'fname', 'mname', 'lname', 'Sex' ] };
jeffa
In reply to (jeffa) Re: associative array problem
by jeffa
in thread associative array problem
by Gerryjun
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |