Perl programming on MPE/iX - April 2002
Solution Symposium Page 12April 4, 2002
subroutines
sub max {
my $max = shift(@_);
foreach $foo (@_) {
$max = $foo if $max < $foo; }
return $max;
}
$bestday = max($mon,$tue,$wed,$thu,$fri);
• parameters passed via @_ array
• @_[0] = parm1, @_[1] = parm2, etc
• @_ is an alias (i.e. call by reference)
• private variables declared with my
• return or the value of the last expression is the functional return value