Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Making XP Change

by Paladin (Priest)
on Jun 09, 2005 at 21:04 UTC ( #465325=note: print w/ replies, xml ) Need Help??


in reply to Making XP Change

Heh.. this is great. One small bug fix needed though:

$ perl xp_o.pl 2731 XP = 2731 2731.00 initiates 136.55 novices, 11 to promotion 54.62 acolytes, 31 to promotion 27.31 scribes, 31 to promotion 13.65 monks, 131 to promotion 5.46 friars, 231 to promotion 2.73 abbots, 731 to promotion 1.71 bishops, 1131 to promotion 1.19 pontiffs, 431 to promotion 0.91 saints, 2731 to promotion a pontiff, 2 monks, a novice, and 1a initiates

Note the "1a initiates". It should be 11. Replace the final bit with:

s<(?:^|\D)(1 [a-z]+(?:, 1 [a-z]+)*)>{ my @ranks = $1 =~ /[a-z]+/g; " a " . join( ', ', @ranks ) }ge; s/^ //; if ( /,.+,/ ) { s/(.+),([^,]+)/$1, and$2/; } print

Which gives:

$ perl xp.pl 2731 XP = 2731 2731.00 initiates 136.55 novices, 11 to promotion 54.62 acolytes, 31 to promotion 27.31 scribes, 31 to promotion 13.65 monks, 131 to promotion 5.46 friars, 231 to promotion 2.73 abbots, 731 to promotion 1.71 bishops, 1131 to promotion 1.19 pontiffs, 431 to promotion 0.91 saints, 2731 to promotion a pontiff, 2 monks, a novice, and 11 initiates


Comment on Re: Making XP Change
Select or Download Code
Re^2: Making XP Change
by diotalevi (Canon) on Jun 09, 2005 at 21:37 UTC
    Oh, sorry. Isn't this just the most excrebale code you've ever seen put out by someone supposedly competent? *wink*

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2014-09-16 14:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (26 votes), past polls