in reply to Parsing XML: Not an Array/Hash Reference Error

  1. use Data::Dumper; at the top
  2. Just before the line where the error appears, print Dumper $variable;
This will let you see exactly what you have in hand. If necessary, back up to where you assign that variable and dumper the source's contents.

Once you can see what you're working with, it is MUCH easier to navigate the reference tree.

Replies are listed 'Best First'.
Re^2: Parsing XML: Not an Array/Hash Reference Error
by leighgable (Acolyte) on Aug 15, 2009 at 13:19 UTC
    Hello SJ,

    I should have mentioned in my original post that I was getting the error in the foreach loop. Do you have a suggestion for where I could call Dumper to diagnose the problem?

    If I call the node variable $e before the foreach loop it's undefined, but if I call it within, the program fails before Dumper can return a value.

    All the best, Leigh