I am trying to strip zip codes out of a table which looks like this:

<tr class="black12Arial">
       <td bgcolor=#ffffdc>10001</td>
       <td BGCOLOR=ffffff>NY</td>
       <td BGCOLOR=ffffff>212</td>
       <td BGCOLOR=ffffff>NEW YORK</td>
       <td BGCOLOR=ffffff>40.7496</td>
       <td BGCOLOR=ffffff>-73.9971</td>

The zip code is between the tags <td bgcolor=#ffffdc> and </td>.

Now, the code below outputs all text inside all <td> pairs:

use HTML::TokeParser;
my $file = shift;
my $p = HTML::TokeParser->new($file);
while ($p->get_tag('td')) {
       print $p->get_text(), "\n";
}

If I substitute 'td bgcolor=#ffffdc' for 'td' in line 4, however, the
output is zilch.

Can anyone tell me how to specify only the tag with the attribute
bgcolor equal to #ffffdc?

Thank you.

Dan

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to