Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Shortcut operator for $a->{'b'}=$b if $b;

by Codon (Friar)
on Sep 20, 2005 at 16:35 UTC ( #493509=note: print w/ replies, xml ) Need Help??

in reply to Shortcut operator for $a->{'b'}=$b if $b;

What is the correlation between 'b' and $b? Is one used to derive the other? If so, then map may help.

$a = { map { $val = some_derivation($_) ? ( $_ => $val ) : () } qw(a b c) };
Ivan Heffner
Sr. Software Engineer, DAS Lead, Inc.

Comment on Re: Shortcut operator for $a->{'b'}=$b if $b;
Select or Download Code
Replies are listed 'Best First'.
Re^2: Shortcut operator for $a->{'b'}=$b if $b;
by rokadave (Sexton) on Sep 20, 2005 at 16:40 UTC
    No correlation at all. This all started when I discovered the ||= operator, which test the assignee for truth, upon false assigns the assignor. I wanted to test the other side, and assign upon false.

    I think my answer is no.

      "assigns the assignor"? Every definition I can find for "assignor" defines it as the person (or in the case operator) who does the assignment. In other words, "=" is the assignor, not "$b".

      The standard terminology for assignments is "lvalue" for the variable receiving the value (which is usually on the *l*eft) and "rvalue" for the value being copied (which is usually on the *r*ight).

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2015-11-28 00:35 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (735 votes), past polls