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


in reply to Parsing hashes with variable structure

What do line 138 and relevant surrounding lines look like?
  • Comment on Re: Parsing hashes with variable structure

Replies are listed 'Best First'.
Re^2: Parsing hashes with variable structure
by SomeNoob (Initiate) on Nov 09, 2012 at 00:33 UTC

    Line 138 itself is the if(exists...) line and it's in the middle of a loop going through the array of references to different user hashes.

      Perhaps you meant the following? (I added {} around $usernumber)
      if( exists $xml->{$usernumber}->{"user"}->{"firstname"} ) {...}

      EDIT: You may also need to extend it as such: (but it is difficult to tell for sure w/o seeing more context)

      if( ref eq 'HASH' and exists $xml->{$usernumber}->{"user"}->{"firstnam +e"} ) {...}

        That is what I meany, yes, sorry.