title: Perl 2D Array with undef to CSV
body: <p>I have to change a 2D array with undef enteries into a csv file. The dumper values looks like </p>
  
  <pre><code>VAR1      [
              'Entry1',
              undef,
              undef,
              undef,
              17
            ],
            [
              'Entry2',
              8,
              undef,
              undef,
              17
            ],
            [
              'Entry3',
              undef,
              4,
              undef,
              17
            ],
  </code></pre>
  
  <p>For undef, I need to put 0. I am using the code below, but its not giving required results.</p>
  
  <pre><code>    open MYFILE, "&gt;&gt;new.csv";
      for ($i=1,$i &lt;= $flag, $i++){
          print MYFILE "$outputArray[$i][0],";
          for ($j=0,$j&lt;= 4, $j++){
          print MYFILE int($outputArray[$i][$j]).",";
          }
          print MYFILE "\n";
      }
      close MYFILE;   
  </code></pre>
  
  <p>My final csv would be something like </p>
  
  <pre><code>Entry1,0,0,0,17
  Entry2,8,0,0,17
  Entry3,0,4,0,17 
  </code></pre>