Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: Allocation of anonymous arrays

by dsheroh (Prior)
on Feb 07, 2014 at 10:53 UTC ( #1073851=note: print w/replies, xml ) Need Help??

in reply to Allocation of anonymous arrays

Your coworker is either using some extremely deep magic here or (much more likely) that assignment doesn't do what he thinks it does.

Hash keys are strings, not scalars. So, when you try to use an array ref as a hash key, it gets stringified and your hash key is the resulting string (e.g., the literal text "ARRAY(0xdeadbeef)"), not the original reference. If he really wants 'random' unique keys for the hash, he could just as well use [] for all the keys. (Or, really, if you're going to use random garbage keys for your hash, you may as well use an array instead, since you won't be able to do key-based lookups anyhow.)

As for your actual question, meditate upon this:

$ perl -e 'print [] . "\n" . [] . "\n" . [] . "\n";' ARRAY(0x9e557ec) ARRAY(0x9e6ef80) ARRAY(0x9e6efbc)
Three references to empty anonymous arrays in a single statement, yet each is unique.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1073851]
[LanX]: D : Oberbefehlshaber
[GotToBTru]: yeah, thats the story I remember. some card the President is supposed to carry around at all times
[GotToBTru]: I suppose the actual details about what is necessary to actually do something is kept fuzzy deliberately
[LanX]: the interview was with the guy who designed the process
[LanX]: in the 70s
[GotToBTru]: so the font on the card is probably NOT Comic Sans
[GotToBTru]: that's a relief
[LanX]: Bruce_G._Blair
[choroba]: as in embossed card?

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2017-01-20 12:55 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (174 votes). Check out past polls.