should be$_->[1] = "B" for @sort_a_pos[0 .. $pct]; $_->[1] = "-" for @sort_a_pos[$pct+1 .. $#array-$pct-1]; $_->[1] = "A" for @sort_a_pos[$#array-$pct .. $#array];
$_->[1] = "B" for @sort_a_pos[0 .. $pct-1]; $_->[1] = "-" for @sort_a_pos[$pct .. $#array-$pct-1]; $_->[1] = "A" for @sort_a_pos[$#array-$pct .. $#array];
You probably got confused (like me) by the OP's weird math of 10 * 10% = 2. The output he gave was for 20%.
In reply to Re^2: Top and bottom 10 percent elements of an array
by ikegami
in thread Top and bottom 10 percent elements of an array
by sesemin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |