in reply to converting list of rankings into list of rankratio's.

What data structure do you have the data in? That will determine the details of how to do this.

Lets suppose you can get a column as a list (not necessarily an array). You can grep to remove db NULL's, which are undef in perl, and use references to the data to do something like this.

# $data is a hashref, a standin for the data struct you have my @ranks = \(grep {defined} values %$data); my $idx = 0; $$_ = ++$idx for sort {$$a <=> $$b} @ranks; # step 1 & 2 $$_ /= $idx for @ranks; # step 3
The values are changed in place in the original data structure because we work with references to those locations. Division by zero is avoided because for over an empty list never does a division.

After Compline,
Zaxo