From the example you gave me, it works perfectly but when I put a variable to indentify the correct value what I want, it gives an error "xmlXPathCompiledEval: 1 object left on the stack". Here an emaple using ur example I change this my $from_path = q{/category/subcategory/product[product_id = "800.55.01"]}; to this my $from_path = q{/category/subcategory/product[product_id = $prod]};. It will show the error message.