Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Render numeric sequence as array of letters

by BrowserUk (Patriarch)
on May 19, 2003 at 21:24 UTC ( [id://259304]=note: print w/replies, xml ) Need Help??


in reply to Render numeric sequence as array of letters

Updated sort to numeric!

sub grade{ my (%h, %i); @h{ ('A' .. 'I')[0..$#_] } = @_; @i{ values %h } = keys %h; @i{ sort{ $b <=> $a } keys %i }; } my @n=(5, 100, 2, 8, 40); print grade @n; B E D A C

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://259304]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-26 06:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found