Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: &&= vivify keys?

by oha (Friar)
on Apr 18, 2012 at 09:10 UTC ( #965680=note: print w/replies, xml ) Need Help??


in reply to Re: &&= vivify keys?
in thread &&= vivify keys?

so true!

not sure why, but i was expecting it to be the same as

$x{a} && $x{a} = 1;
thank you!

Replies are listed 'Best First'.
Re^3: &&= vivify keys?
by ikegami (Patriarch) on Apr 18, 2012 at 21:16 UTC

    Actually, you're closer to the truth than Eliya is. The assignment is indeed conditional.

    Aside from the syntax error from missing parens, the problems both yours and Eliya share are:

    • 1 is actually evaluated before anything else,
    • $x{a} is only evaluated once, and
    • $x{a} is (only) evaluated in lvalue context.

    See Re^2: &&= vivify keys?.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2022-01-18 05:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (52 votes). Check out past polls.

    Notices?