Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Parsing hashes with variable structure

by frozenwithjoy (Curate)
on Nov 09, 2012 at 00:40 UTC ( #1003037=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Parsing hashes with variable structure
in thread Parsing hashes with variable structure

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"} ) {...}


Comment on Re^3: Parsing hashes with variable structure
Select or Download Code
Re^4: Parsing hashes with variable structure
by SomeNoob (Initiate) on Nov 09, 2012 at 00:46 UTC

    That is what I meany, yes, sorry.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1003037]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2015-07-02 02:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (25 votes), past polls