Rodrick Brown wrote:
>
> I'm having a hardtime coming up with the correct formula for calculating
> percentile on an array of random intergers. Anyone care to assist?
> 
> #!/usr/bin/perl -w
> use strict;
> my @numbers = (10.22,20.33,22.3,11.3,12.4,8.3,10.4);
> sub calc {
>   my ($p,$n) = @_;
>   return $p/100 * ($n + 1);
> }
> 
> printf "Percentile: %s\n", calc($_,$#numbers) for qw/25 50 75 90 95 99/;

If you show us which of the many possible ways you want to use to calculate
percentiles then we can help you code it in Perl.

Rob

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to