Subroutine parameter default value
sub addem
{
my %hash =
(
OPERAND1 => 2,
OPERAND2 => 3,
@_,
);
return $hash{OPERAND1} + $hash{OPERAND2};
}
print "The result is: " . addem();
print "\n";
print "The result is: " . addem(OPERAND1 => 3);
Related examples in the same category