Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Trouble Parsing HTML

by nerfherder (Monk)
on Jan 28, 2005 at 22:47 UTC ( #426150=note: print w/replies, xml ) Need Help??


in reply to Trouble Parsing HTML

TMTOWTDI, that's for sure! :-)
#!/usr/bin/perl -w use strict; use HTML::TokeParser; my $p = HTML::TokeParser->new( *DATA ); for (my $token = $p->get_tag("select")) { my $select = $token->[1]{name} ; print "$select\n"; } while (my $token2 = $p->get_tag("option")) { if ($token2->[1]{selected}) { my $option = $p->get_text("option"); print "$option\n"; } } __DATA__ <select name="cmbPurpose" id="cmbPurpose" tabindex="3"> <option value="CD">Cell Development</option> <option value="MS">Miscellaneous R&amp;D</option> <option value="NP">New Package</option> <option value="NR">Non R&amp;D</option> <option value="PC">New process</option> <option selected="selected" value="PD">New product</option> <option value="SP">Sustaining Product</option> <option value="SW">Software and Platform</option> <option value="TD">Technology Development</option>

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2021-09-24 07:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?