treebeard has asked for the wisdom of the Perl Monks concerning the following question:
tr </tr><tr> <td><font size="2" face="Arial,Helvetica"> <hr size="2" width="100%"> Title: <b>2004-10-15 Off Season Rosters</b><BR> Post by <b>sydvicious</b> on <b>Oct 15<sup>th</sup>, 2004, 7:24pm< +/b> <hr width="100%" size="1"> I know, the keeper years all say "1".<br><br><pre><br>TR +ANSACTIONS:<br><br>Scott - Activated Catalanotto_Frank/TOR; Waived Ca +stilla_Vinny/COL<br>Scott - Activated Day_Zach/MON; Waived Reese_Poke +y/BOS<br>Scott - Activated Hernandez_Runelvys/KCA; Waived Lowe_Derek/ +BOS<br>Scott - Activated VanBenschoten_John/PIT; Waived Quantrill_Pau +l/NYA<br>Scott - Activated Williamson_Scott/BOS; Waived Reyes_Dennys/ +KCA<br>Sean - Activated Burnett_Sean/P
#!d:/perl56/bin use strict; { package HTMLParser; use base "HTML::Parser"; sub text { my ($self, $origtext) = @_; $origtext =~ s/ //g; $self->{TEXT} .= $origtext; ### Read through hash and test each line against array @field = qw (C 1B 2B 3B SS OF1 OF2 OF3 DH B1 B2 B3 B4 B5 B6 B7 + B8 SP1 SP2 SP3 SP4 SP5 SW1 SW2 SW3 SW4 SW5 SW6 SW7 RP1 RP2 RP3 RP4 R +P5 RP6 RP7 IR); my @test = split(/\s*[ ]/,$origtext); foreach $line (@field) { if ($test[0] eq $line) { print "$test[1]\n"; } } } } my $leaguefile = $ARGV[0]; open(DATAFILE1,"$leaguefile") || die "Cannot open test file"; my $sp = new HTMLParser; while (<DATAFILE1>) { $sp->parse_file($_); } $sp->eof; close DATAFILE1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: html::parser question
by jpeg (Chaplain) on Mar 04, 2005 at 16:36 UTC | |
|
Re: html::parser question
by Popcorn Dave (Abbot) on Mar 04, 2005 at 16:54 UTC |