sub
keyword introduces a function@_
is a special array of all calling argumentsshift
operator pulls one argument off calling stackreturn
returns a value to the caller:sub add { my $val1 = shift; my $val2 = shift; |
return $val1 + $val2; } |
Forward to 20 Minutes: Plural Subroutines
Back to 20 Minutes: Comparisons Up to PerlInside section index Up to Perl Inside course index |
Perl Inside: PerlInside - 11
Copyright © 1999, Brian Jepson
|