Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: HTML Table Parse

by matija (Priest)
on May 13, 2004 at 11:13 UTC ( [id://353031]=note: print w/replies, xml ) Need Help??


in reply to HTML Table Parse

use HTML::TokeParser; $p = HTML::TokeParser->new("$tablesource") || die "Can't open $tablesource: $!"; # .... while (my $token = $p->get_token) { if (($$token[0] eq "S") && (lc $$token[1] eq "td") { $intd=1; } elsif ((($$token[0] eq "E") && (lc $$token[1] eq "td") { $intd=0; } elsif (($$token[0] eq "S") && (lc $$token[1] eq "font") { $color=$$token[3]->{color}; } elsif (($$token[0] eq "E") && (lc $$token[1] eq "font") $color=$defaultcolor; } elsif ($$token[0] eq "T") { next unless $intd; $text=$$token[1]; $color{$text}=$color; } }
At this point you have a hash called %color where the key is the number from the table, and the value is the color.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://353031]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-24 12:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found