I've never used HTML::TokeParser myself, but I think I know what's the problem. The $parser->get_tag('option') in the inner loop doesn't care about the </select> and tries to give you all <option>s it can find in the rest of the file and when it at last returns undef, the HTML::TokeParser's "cursor" is at the end of the HTML. Therefore there are no more tags to find.
I believe you'll have to do it differently. I think you'll have to have just one look looking for any <input>, <textarea>, <select> or <option>, remember the name of the last seen <select> and append any found <option> to that <select>.
HTH, Jenda
Always code as if the guy who ends up maintaining your code
will be a violent psychopath who knows where you live.
-- Rick Osborne
In reply to Re: A question about HTML::TokeParser
by Jenda
in thread A question about HTML::TokeParser
by theguvnor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |