Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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

by VSarkiss (Monsignor)
on Aug 17, 2001 at 05:55 UTC ( #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? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2021-10-21 19:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (83 votes). Check out past polls.

    Notices?