in reply to Script for MAX and Min

Hope you can explain this one to your instructor. It may not be the most efficient way to do it (oh yeah, and it pads your numbers with zeros, but that's ok, isn't it?) :)
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; }
I've given you the methods, you just need to call them. You can check out perlboot :)