in reply to xpath problem

As a read of the XML::XPath documentation for the new method reveals (documentation explaining how to use things? Balderdash!), the xml argument is for passing literal XML which you want parsed. Your string "query.xml" is not XML, hence you get an error.

The cake is a lie.
The cake is a lie.
The cake is a lie.