in reply to Help with code for adding two arrays.

Look at the compilation error:

Useless use of push with no values at stuff.pl line 29. Type of arg 1 to push must be array (not scalar dereference) at stuff. +pl line 29, near "$sums) " Execution of stuff.pl aborted due to compilation errors.

Then look perldoc -f push. You need to give it an array, not a scalar:

push( @sums, $rray1[$_] + $rray2[$_] );

As a general rule, you might also consider using use warnings and use strict at the top of your scripts. While this was a simple syntax error, those two modules will help you identify other problems you may encounter.

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.