On Tue, 2001-11-27 at 22:22, Pete Emerson wrote:
> So for example, if I have
> <input type='radio' name='variable1'><option value='1'>Strongly Agree

I'd use HTML::TokeParser, because it's lovely.

Assuming you initialise a new TokeParser object to $p, try:

my %option_choice;

# for each <input>, if there's a 'name=' token, initialise a hash of:
# the name token => choice.  (i.e. 1 => 'Strongly Agree')

while (my $token = $p->get_tag("input") {
  if ($token->[1]{name}) {
     $option_choice{$token->[1]{name}} = $p->get_trimmed_text("/b");
  }
}

Note that this is untested, and I'm in need of sleep.  If anyone more
alert than myself can see anything stupid, please let me know. :-)

If you need a hand with initialising the object, I've got a tutorial to
TokeParser (though also manipulating XML:RSS) up on the web at:

http://www.perl.com/pub/a/2001/11/15/creatingrss.html

Hope this helps,

- ~C.
-- 
$a="printf.net"; Chris Ball | chris@void.$a | www.$a | finger: chris@$a
As to luck, there's the old miners' proverb: Gold is where you find it.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to