in reply to Re^2: ||= oddity
in thread ||= oddity
If it did work, it would produce useless results.
Given that (LHS ||= RHS) means (LHS = LHS || RHS),
Then (@a ||= (1,2,3)) means (@a = @a || (1,2,3)) and thus (@a = $#a+1 || 3).
Why would you ever want that.
On the other hand, it would be useful to expand the definition of the ||= operator so that (@a ||= EXPR) means (@a = @a ? @a : EXPR).
Similarly, it could be useful to expand the definition of &&= such that (@a &&= EXPR) means (@a = @a ? EXPR : ()).
However, none of **=, +=, *=, &=, <<=, -=, /=, |=, >>=, .=, %=, ^=, //= and x= would be useful for arrays.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: ||= oddity
by ambrus (Abbot) on May 30, 2008 at 09:09 UTC | |
Re^4: ||= oddity
by ambrus (Abbot) on May 30, 2008 at 09:14 UTC |