in reply to LibXML 'Fun'

I'm not familiar with this module, so this may be off base, but it looks like you are creating the option tags, but not the select tag that encloses them. Can you show us the HTML that gets printed out?

Other than that, you might want to try something along the lines of Data::Dumper or run this through the debugger and check the contents of $text, $node, and $list[2] at different stages.