in reply to Hash Profile
Untested, btw. I'm not sure what you mean with shortest and longest numerical key. I'll assume here you mean minimum and maximum. If you mean shortest string-wise, use minstr and maxstr instead.use List::Util qw(min max sum); my $min = min keys %hash; my $max = max keys %hash; my $avg = sum(keys %hash) / keys %hash; # Won't work: avg keys %hash;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Hash Profile
by jeroenes (Priest) on Apr 24, 2001 at 10:17 UTC |