thedarkages: (Default)
[personal profile] thedarkages
I 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):

#!/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.
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

thedarkages: (Default)
thedarkages

April 2016

S M T W T F S
     12
3456789
10111213141516
171819 20212223
24252627282930

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Mar. 15th, 2026 06:46 pm
Powered by Dreamwidth Studios