Re: Merging Multiple Array elements
- From: Jürgen Exner <jurgenex@xxxxxxxxxxx>
- Date: Sun, 15 Jan 2012 12:45:54 -0800
Pradeep Patra <smilesonisamal@xxxxxxxxx> wrote:
The reason I need this requirement because I have something as
@array1 = returned by func1(i=0); [NOTE: this is just for illustration
not actual code]
@array2 = returned by func1(i=1);
I cannot change the func1(i); So I have to summing all the sub arrays
returned by func1(i) itself.
Any suggestions how to go about this?
- If you really want to collect the individual return results before
summing them up then use an array of (references to) arrays as explained
- with each iteration (i=0, i=1, ...) don't store the return result, but
add it to your grand total right away
- and last but not least: please post actual Perl code, not some