# using a loop @foo = qw(1 2 3 4); @bar = qw(1 2 3 4); for ($i = 0; $i < 4; $i++) { $foobar[$i] = $foo[$i] + $bar[$i]; } # @foobar is now (2 4 6 8).