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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.