Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Top and bottom 10 percent elements of an arrayby sesemin (Beadle) |
on Apr 29, 2010 at 04:35 UTC ( [id://837442]=perlquestion: print w/replies, xml ) | Need Help?? |
sesemin has asked for the wisdom of the Perl Monks concerning the following question: Hi Monks, I need to sort an array ascending or descending does not matter. then choose the top and bottom 10 percent of data, replace them with A (for tops) and replace them by B (for lows). The remaining replace by "-". The put the data back to their original order.Something like the following. The 10 percent is hypothetical can be any percentage.
I know how to sort by index like the following code but I am just wondering if you can help me to learn how to the replacement. May be map function is the way to go.
Back to
Seekers of Perl Wisdom
|
|