in reply to Re^5: Restore the original order of an array after sort and performing some funchtion on array values
in thread Restore the original order of an array after sort and performing some funchtion on array values

Thanks a lot. Honestly it is not an exam, I have a larger code in which at some point of it I needed to do this calculation. The algorithm is provided to me by a statistician who was doing it in R but I had to convert it to perl. (Actually you did).

The red font are the numbers you printed at the end. If any of these >1 then they have to replaced by 1.

In terms of run time and size of the actual hash varies between 200 to 4000 key/values. I do not think it take a long time to run. Appreciated it again.

  • Comment on Re^6: Restore the original order of an array after sort and performing some funchtion on array values

Replies are listed 'Best First'.
Re^7: Restore the original order of an array after sort and performing some funchtion on array values
by BrowserUk (Patriarch) on Mar 04, 2010 at 01:21 UTC
    Thanks a lot. Honestly it is not an exam,

    Then all you need to finish the task is a last line of:

    $pvalues{ $_ } = min( $pvalues{ $_ }, 1 ) for keys %pvalues;

    It'd still be a good idea to make sure you understand how the whole code works.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.