Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get_tag help - finding specific attributes? 1

Status
Not open for further replies.

Snipe2020

Technical User
Sep 26, 2008
2
GB
Hi - I'm very new to Perl and strugling to figure out how you can parse and extract html content from tags with specific attributes.

So far I have this:

my $parser = HTML::TokeParser->new(\$content) ||
die "Could not parse page";
while ($parser->get_tag("b")) {
print $parser->get_text(), "\n";
}

which returns the content of all <b> tags from the target file, but what I need is for it to only return the content from <b> tags which have a specific class, say <b class="total"> for example - so far everything I've tried has failed - any help would be greatly appreciated :0)
 
I'd say that rates a star [smile]

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top