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

Reply via email to