in reply to Hash Profile

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;
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.

Update: Doh! There is no avg function. Code is updated to reflect that.

ar0n ]

Replies are listed 'Best First'.
Re: Re: Hash Profile
by jeroenes (Priest) on Apr 24, 2001 at 10:17 UTC
    use Math::VecStat qw(average); my $avg = average( keys %hash );
    For more stats, take PDL

    Jeroen
    "We are not alone"(FZ)