Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Curious about Hashes which viewed as a list has only one item

by ack (Deacon)
on Feb 29, 2008 at 05:28 UTC ( #671105=note: print w/replies, xml ) Need Help??


in reply to Re: Curious about Hashes which viewed as a list has only one item
in thread Curious about Hashes which viewed as a list has only one item

Thanks, errto. That was what I suspected would be the case. So do I understand correctly that if I were to do something like:

print "yep" if(defined $foo{HASH(xxx)});

then I'd not expect any print? (The xxx is the stringified octal code in the pre-stringified reference)

Also, thanks for the note on the stringified reference. I remember well (from having made the erroneous assumption quite a few times) that the key is just the stringified version of the reference and is not, itself, a referene.

Again, thanks for the info...it really helped.

ack Albuquerque, NM
  • Comment on Re^2: Curious about Hashes which viewed as a list has only one item

Replies are listed 'Best First'.
Re^3: Curious about Hashes which viewed as a list has only one item
by Errto (Vicar) on Feb 29, 2008 at 17:37 UTC
    Well, for one thing if you were actually writing that literally you'd have to put the HASH(xxx) bit in quotes. But you're correct, that statement would not print anything. But if you changed defined to exists, then it would print yep because that key is really present in the hash.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2019-06-17 15:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (80 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!