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.

Date: 2006-10-25 04:37 am (UTC)
From: [identity profile] omarius.livejournal.com
Shoot, I'm no programmer either, so I think that is the shizznitz. You won an anthology with Perl. I love the very idea of it.

Date: 2006-10-29 03:00 pm (UTC)
From: [identity profile] vlforman.livejournal.com
so cool.

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 09:59 pm
Powered by Dreamwidth Studios