How do I find the sum of all values from two different arrays in Perl?
Posted
by HelloWorld
on Stack Overflow
See other posts from Stack Overflow
or by HelloWorld
Published on 2010-03-24T21:23:45Z
Indexed on
2010/03/25
0:13 UTC
Read the original article
Hit count: 589
How to find the sum of all values from two different arrays in Perl?
@array1 = (1, 2, 3);
@array2 = (10, 10, 10);
@sumofarray1and2 = ?
So I figured I can do two kinds of things here. I can do two foreach
loops and add contents of @array1
and @array2
first then get the sum of both.
© Stack Overflow or respective owner