As AnonyMonk notes, you've left us guessing about the nature of the rule(s) by which you are planning to derive your various products, namely:
percentage of "@sorted_array[0]" is 1%.
result will be: @final_array[0]=1
Whatever your method is, it eludes me (and given the lack of answers on a day with few new question, possibly is a mystery to others as well) especially since there's no obvious (again, 'to me') common path for transforming
- "@sorted_array[0], -150," to 1%
and
- "@sorted_array[3], 0," to 75%.
And then there is the trailing @final_array[5]=75 on line 7: Whence came that inexplicable entry? Is it a mere typo or cut'n'paste error or does it have some significance to your problem and if so, what? If it's somehow related to @sorted_array[5] (which is "2"), pray explain.
I won't claim that explanation is good for the soul, but yours would surely be a good aid to those of interesting in helping people learn Perl... which is one key to what this site is about. See I know what I mean. Why don't you?
Come, let us reason together: Spirit of the Monastery
If I've misconstrued your question or the logic needed to answer it, I offer my apologies to all those electrons which were inconvenienced by the creation of this post.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.