http://www.perlmonks.org?node_id=935235


in reply to Re: How to get paired values from the nested XML structure?
in thread How to get paired values from the nested XML structure?

You can use Data::Dumper to see what your variables contain. For articles without quantity, $amount is the empty string q(), which means it is defined. If you replace // with ||, you will get the desired behaviour.