# calling the subroutine. in this example the # first arg is a variable, second is a literal value my $arg1 = 100; my $return_value = add_these($arg1, 200); print $return_value; # subroutines receive arguments via an array named @_ # this version gets the args by array index sub add_these{ my $first = $_[0]; my $second = $_[1]; my $answer = $first + $second; return $answer; } # this one shifts values off the front of the array # note that @_ is implied if an array is not given as # the argument to shift. commonly seen as: # my $value = shift; sub add_these{ my $first = shift @_; my $second = shift @_; my $answer = $first + $second; return $answer; } # as shown here it is not necessary to assign the # arguments to an intermediate variable - you can # use them directly (however the extra variables # often makes the code more readable) sub add_these{ my $answer = $_[0] + $_[1]; return $answer; } # you don't even need to return a variable, you can # directly return the value calculated by an expression, # as shown here and in the "hint" example you were given sub add_these{ return $_[0] + $_[1]; }