Thanks to the monks who helped me with my previous problem, I'm ready to finally complete this project I've been working on, just one more problem to get past. Ok so here it goes:
I have these 8 character values stored in a list. Here are 2 examples: @list = 'a' '6' '5' '5' '4' '5' '0' 'e'. As you can see these are in hexadecimal. This is important. I need to be able to use these separate values to create another list, but this time it is a list of values of tuners (the hardware I'm running this perl script over carries 32 tuners, assigned 0-31.). before i do more explaining, these values are stored as string values. do I need to convert them to anything else before I can manipulate them as if they were hex?
more explaining needs to be done, so I'm going to do my best. each of those hex values corresponds to 4 different tuners, going backwards. the first value (a in the example) corresponds to tuners 31-28. the second value (6 in exmpl) 27-24. The third 23-20. 4th: 19-16. 5th: 15-12. 6th: 11-8. 7th: 7-4. 8th: 3-0. in each of those groups of tuners, they equal a value that will be added to the mask if they should be added to my list. the highest tuner is equal to an 8. the 2nd highest is equal to a 4. the third highest is equal to a 2, and the last is equal to a 1. So in the example, these tuners should be added to my list according to the first value (a): tuners 31 and 29. The second value is saying that tuners 26 and 25 should be turned on. The third is saying that tuners 20 and 21 should be added. The mask can change so the code needs to be able to account for that. I have no idea how to do this without at least a little bit of guidance and help. If I need to do some more explaining, then I will, just ask away.
In the end, the example should have stored in @tuner_list the tuners: 1,2,3,8,10,14,16,18,20,22,25,26,29,31.
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.