in reply to Translation of R functions to Perl subroutines
Perhaps therefore you should challenge the original requirement: if these values are prohibitively slow to calculate "one at a time," as you seem to have just determined, then you should look for an alternate approach, perhaps with the assistance of your friendly neighborhood statistician boss. Maybe the calculation of p-values demands re-processing of the entire dataset ... once for each and every member of that dataset ... thus becoming a prohibitively-expensive O(x^y) computational approach for the number of observations that must be considered.