#!/usr/bin/perl -w

@arr = ( 0, 1, 2, 3, 4 );
$x = sumvars(@arr);
print "The sum is: $x\n";
print "Half the sum is: ", sumvars(1, 2, 3, 4)/2, "\n";

sub sumvars {
   $sum = 0;
   foreach $arg ( @_ ) {
      $sum += $arg;
   }
   return $sum;
}
