in reply to Script for MAX and Min
I've given you the methods, you just need to call them. You can check out perlboot :)Package MinMax; sub new { my $proto = shift; my $class = ref($proto) || $proto; bless [ sort map { sprintf "%09d", $_ } @_ ], $class; } sub min { @{shift()}[0]; } sub max { @{shift()}[-1]; } sub total { my $self = shift; my $total = 0; $total += $_ for @$self; $total; } sub avg { my $self = shift; $self->total/@$self; }
|
|---|