Just won ZYZZYVA contest
Oct. 24th, 2006 08:26 pmI just won a ZYZZYVA contest, and am getting one of their anthologies. You had to guess the number of literary magazines featured on NewPages.com. I looked at the data, and wrote the following program (with a little help from comp.lang.perl.misc):
I am so not a programmer! I could have fetched the pages, but they needed to be merged, and I have no idea how to elegantly merge two HTML documents programmatically.
Face it, I'm just a n00b. But I did win the anthology.
#!/usr/bin/perl -w
use warnings;
use strict;
use diagnostics;
use HTML::TokeParser;
my $fh = \*main::DATA;
my $p = HTML::TokeParser->new($fh) || die "Bad open: $! \n";
my $litmags = 0;
while (my $token=$p->get_tag('h3')){
$litmags++;
}
print "Number of Literary Magazines: $litmags\.\n";
# put the contents of the New Pages web page below the __DATA__ line
__DATA__
I am so not a programmer! I could have fetched the pages, but they needed to be merged, and I have no idea how to elegantly merge two HTML documents programmatically.
Face it, I'm just a n00b. But I did win the anthology.
no subject
Date: 2006-10-25 04:37 am (UTC)no subject
Date: 2006-10-29 03:00 pm (UTC)