1 sub min { 2 local $min = shift; 3 for (@_) { 4 $min = $_ if $_ < $min; 5 } 6 7 return $min; 8 } 9 10 sub max { 11 local $max = shift; 12 for (@_) { 13 $max = $_ if $_ > $min; 14 } 15 16 return $max; 17 }
时间: 2024-09-30 07:00:55
1 sub min { 2 local $min = shift; 3 for (@_) { 4 $min = $_ if $_ < $min; 5 } 6 7 return $min; 8 } 9 10 sub max { 11 local $max = shift; 12 for (@_) { 13 $max = $_ if $_ > $min; 14 } 15 16 return $max; 17 }