I like numbers very much :).
Once I asked myself (I was thinking about cumulative audience and the voting system)
how many ++ are in the pool for a single day. Here a simple snippet that counts them for
me.
#!/usr/bin/perl
use strict;
use LWP::Simple;
use HTML::TableExtract;
my $votes_in_the_pool = 0;
my @number_of_votes = ( 0, 5, 8, 12, 16, 20, 25, 30, 35, 40);
my $page_content = get( 'http://www.perlmonks.org/index.pl?node=Number
+%20of%20Monks%20by%20Level' )
|| die ("Can't get page content!\n");
my $parser = new HTML::TableExtract();
$parser->parse( $page_content );
my $table = $parser->table_state(1, 2);
print "Today...\n";
foreach my $row ( $table->rows ) {
foreach ( @$row ) {
if ( /Level (\d+)\n\((\d+)\)/s ) {
print "there are $2 monks of level $1\n";
$votes_in_the_pool += $number_of_votes[ $1 - 1 ] * $2;
}
}
}
print ".. for a total of $votes_in_the_pool votes\n";
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.