in reply to Shortcut operator for $a->{'b'}=$b if $b;
might abort the assignment if $b is not true. I can't test it at the moment. Another idea that occurs to me is{ $a->{'b'} = do {$b or last} }
which expresses pretty directly what you said in your last sentence.($a->{'b'} = $b) or delete $a->{'b'};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Shortcut operator for $a->{'b'}=$b if $b;
by japhy (Canon) on Sep 20, 2005 at 16:54 UTC | |
|
Re^2: Shortcut operator for $a->{'b'}=$b if $b;
by ikegami (Patriarch) on Sep 20, 2005 at 16:52 UTC | |
|
Re^2: Shortcut operator for $a->{'b'}=$b if $b;
by Aristotle (Chancellor) on Sep 20, 2005 at 20:35 UTC | |
by CountZero (Bishop) on Sep 20, 2005 at 21:15 UTC | |
by Roy Johnson (Monsignor) on Sep 20, 2005 at 22:21 UTC |