title: How can I perform mathematical operations on an array of arrays?
body: <p>I have an array of array like below with all numeric values. I want to perform some mathematical operations with these values.</p>
  <ol>
  <li><p>Add and print the values of each array elements.
  e.g.</p>
  <p>sum $VAR1 = sum1
  sum $VAR2 = sum2</p>
  </li>
  <li><p>Add all the values from each variables.
  e.g.</p>
  <p>sum $VAR1 + $VAR2 +...+ $VARn = totalsum</p>
  </li>
  <li><p>Finding percentage of each variable's total (<code>sum1</code>, <code>sum2</code>, etc.) with the totalsum.</p>
  <p>$VAR1 = [
  '17071',
  '16120',
  '16292',
  'upto n numbers'
  ];
  $VAR2 = [
  '1306',
  '1399',
  '1420',
  'upto n numbers'
  ];
  .
  .
  .
  $VARn = [
  '1835',
  '1946',
  'upto n numbers'
  ];</p>
  </li>
  </ol>
  <p>I have tried the below code to perform addition of the first array reference, but it’s not giving me the correct values.</p>
  <pre><code>my $total = 0;
  ($total+=$_) for $input[0];
  print $total;
  </code></pre>