use iXML::TheConstruct; use strict; my $obj = iXML::TheConstruct->new(); # ... get $html and $index $obj->add($html,$index); $output = $obj->output; #... do something with output.