Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Re: Re: XML::Simple isn't simple!

by VSarkiss (Monsignor)
on Aug 17, 2001 at 05:55 UTC ( [id://105602]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: XML::Simple isn't simple!
in thread XML::Simple isn't simple!

Ah, perlref is your friend. To see the difference, look only at the leftmost part of the variable. Simply put, in this line: print $ref{'os'}->{'Linux'}->{'score'};The first part is using a hash %ref, with the key os. (Block out the first arrow and everything that comes later and you'll see what I mean.) Since %ref is not defined at that point, it prints nothing.

On the other hand, in this line: print $ref->{os}{Linux}{score};the first part is using a scalar $ref, and is using an arrow to treat it as a reference -- specifically a hash reference.

As for leaving out the quotes, as of Perl 5.mumble, you don't need to quote strings when they're used as keys to a hash.

GIH (Glad it helped ;-)

Replies are listed 'Best First'.
Re: Re: Re: Re: XML::Simple isn't simple!
by r.joseph (Hermit) on Aug 17, 2001 at 06:10 UTC
    Again, what can I say but thank you. I understand perfectly now, and I should have caught it earlier :). Thanks again!

    r. j o s e p h
    "Violence is a last resort of the incompetent" - Salvor Hardin, Foundation by Issac Asimov

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-25 07:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found