in reply to scope of variable

Please help me to identify the issue. I assumed scope of $d is limited to given call.

A few issues

* In the code you posted $d never has a value -- it might as well not exist

* If you used strict it would complain about $d requiring an explicit package name -- cause what is $d ? where does it come from? who sets its value?

* your sub is called getValue but all it does is print stuff

* You're using XML::Parser but you should be using XML::Twig :) use XML::Twig :) it comes with many examples/tutorials, XML::Twig, XML::LibXML, Mojo::DOM ... see Re: The best module for handling xml for examples, walkthroughs, follow my links and the links they link, like these Re: How to grab a portion of file with regex (don't)(parsing html/xml with xpath/twig/dom, because html::parser is low level), Re: How to grab a portion of file with regex (parsing html/xml with xpath/twig/dom, because xml::parser is low level), Re^4: How to grab a portion of file with regex (parsing html/xml with xpath/twig/dom, because ::parser is low level)