Problems? Is your data what you think it is? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Greetings fellow monks, I just finished an interesting coding problem for work. We have an online test-taking & grading system, and while doing some updates for it, I needed an algorithm that renders a numeric sequence in order by letter, regardless of the numbers within the sequence. For example: 5, 100, 2, 8, 40 ...becomes... B, E, A, C, D After some tinkering, I came up with the following:
I was wondering if any of you all had encountered such a problem in the past and if so if you have any code for it that's shorter than what I've posted. The above works, as far as I can tell, but I have a sneeking suspicion that there's a much better way to write it. (Oh, and the @original_array will never be bigger than 9 elements.) Thanks. gryphon In reply to Render numeric sequence as array of letters by gryphon
|
|