Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Creating CSV term document matrix from a hash stored in multideminsional array

by lobs (Acolyte)
on Mar 03, 2017 at 19:06 UTC ( [id://1183589] : perlquestion . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
               
     while ($element = shift(@numOfWordArr)) {
                  $termsFreq{$element} ++;
    ...
                    $docTerms{$element}++;
                  }
    }
    
  2. or download this
    push(@docArray, \%termsFreq);
    
  3. or download this
    push(@classArr, \@docArray);
    
  4. or download this
    foreach my $subArr_ref(@classArr) {
      print "subArr_ref: ".@{$subArr_ref}."\n";
    ...
        # }
        print $csv $i."\n";
      }