Big advice when asking a question: explain what you are trying to do!!!

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:

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, );
And you can populate your first two keys in the STUDQT hash like so:
foreach (32000011..32000012) { push @{$STUDQT{$_}}, qw(fname mname lname Sex); }
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. . .

Please use Data::Dumper when dealing with complex data structures like %STUDQT, here is what it looks like after the last initialization line:

use Data::Dumper; print Dumper \%STUDQT; #yields: $VAR1 = { '32000011' => [ 'fname', 'mname', 'lname', 'Sex' ], '32000012' => [ 'fname', 'mname', 'lname', 'Sex' ] };
as you can see, '01', '02', etc are not there, meaning that those 8 lines of code that 'define' them are uneccesary.

jeffa


In reply to (jeffa) Re: associative array problem by jeffa
in thread associative array problem by Gerryjun

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.