-----Original Message----- From: chen li [mailto:[EMAIL PROTECTED] Sent: Friday, August 18, 2006 7:00 PM To: beginners@perl.org Subject: calculate the value in an array of array
Dear all, I have an array of array look like this: @array_of_array=( [1,2,3,4,5], [1,2,3,4,5], [1,2,3,4,5], [1,2,3,4,5] ) How do I get the total values for each colume, such as $column1=1+1+1+1; $column2=2+2+2+2; $column3=3+3+3+3; ... Thanks, Li __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> Hi Li Im just sending you the logic.....if you can get the syntax correct then you migt get the desired result. for i 1 - n { sum = 0 for j 1-n { sum= sum + a[j][i] } print coli = sum } Thanks Prasanna -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>