title: How can I sum each column of my data in Perl?
body: <p>I have a file with following data:</p>
  
  <pre>
  1==0==2
  5==3==2
  7==1==0
  </pre>
  
  <p>how to add the numerical value column wise. I need to summarize and print it like</p>
  
  <pre>
  1==0==2
  5==3==2
  7==1==0
  13==4==4   * summation column wise (This is what I want to calculate using perl)
  </pre>
  
  <p>I guess you have misunderstood my question. I have edited my question again by ... i meant I have many such column in the table
  13==4==4 is the summation column wise which I want add to my file.</p>
  
  I was able to do it for first column only but i need to learn how to for all the other columns as well.
  
  <p>my code:</p>
  
  <pre><code>#!/usr/bin/perl
  
  use strict;
  use warnings;
  
  open (TEMPTABLE,"temp_data") or die "Cannot open file\n";
  
  my @temp_table_data=&lt; TEMPTABLE &gt; ;
  chomp @temp_table_data;
  
  my $total_sum;
  for(my $i=0;$i&lt;=$#temp_table_data;$i++)
  {
  print "$temp_table_data[$i]\n";
  my @col=split('==',$temp_table_data[$i]);
  for(my $m=0;$m&lt;1;$m++)
  {
  $total_sum+=$col[$m];
  }    
  }
  print "$total_sum\n";
  
  OUTPUT:
  1==0==2
  5==3==2
  7==1==0
  13
  </code></pre>
  
  <p>I don't want to sum ROW but COLUMN.</p>