Re: Merging Multiple Array elements



Pradeep Patra <smilesonisamal@xxxxxxxxx> wrote:

The reason I need this requirement because I have something as
follows:

@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?

Yes, several:
- If you really want to collect the individual return results before
summing them up then use an array of (references to) arrays as explained
before.
- 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
pseudo-code

jue
.