in reply to XPath to read attributes using XML::LibXML ...

If you used warnings and/or strict, Perl would tell you what you are doing wrong: You are using double quotes, which interpolate.

Please put these two lines at the top of your script and fix all the errors. Then the XPath problem will have gone away:

use strict; use warnings;