#!/usr/bin/perl -w
# Argument_test:
#    VERSION: Version 1 (18 October 2003)
#    PURPOSE: Tests behavior of @_

############## LIBRARIES AND PRAGMAS ################
  use strict;

#################### CONSTANTS ######################

  my $LF = "\n";         # Linefeed
  my $tab = "\t";        # Tab

#################### VARIABLES ######################

  my @array1 = (1, 2, 3, 4, 5);
  my @array2 = (2, 4, 6, 8, 10); 
  my @sum_array;

################### MAIN PROGRAM ####################

  print "array 1: ", join(" ", @array1), $LF;
  print "array 2: ", join(" ", @array2), $LF;
  @sum_array = Add(@array1, @array2);
  print "sum array: ", join(" ", @sum_array), $LF;

#################### SUBROUTINES ####################

#### ADD (array1, array2)
#    Adds each element of an array to the corresponding element of another array

  sub Add {
    my (@a1, @a2) = @_;
    my @sum;
    foreach my $i (0 .. @a1 - 1) {
       $sum[$i] = $a1[$i] + $a2[$i];
    }
    return @sum;
  }
