This:
for my $i($#classArr) {
Does not increment $i like you think it does. Essentially, it loops only once, because $#classArr is only a single number; the last element number in the array.
You want something more like:
for my $i (0..$#classArr){
Which will put the current element number into $i on each iteration, starting from 0.
update: Or, more idiomatically (untested):
for my $class (@classArr){ for my $href (@$class){ for my $key (sort keys %$href){ print $csv "$key-- $href->{$key},"; } } }
In reply to Re: Creating CSV term document matrix from a hash stored in multideminsional array
by stevieb
in thread Creating CSV term document matrix from a hash stored in multideminsional array
by lobs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |