in reply to Re^8: shift in list context buggy?
in thread shift in list context buggy?
The intention is obviously to cover all contexts.
Nothing at all obvious about that conclusion.
It is clear to me that the intent was to document the side effects being equivalent with no implications about return values in any context. And you don't have to go past the very first one in order to verify that:
The following equivalences hold (assuming $[ == 0 and $#a >= $i ) push(@a,$x,$y) splice(@a,@a,0,$x,$y) pop(@a) splice(@a,-1) shift(@a) splice(@a,0,1) unshift(@a,$x,$y) splice(@a,0,0,$x,$y) $a[$i] = $y splice(@a,$i,1,$y) push(@a,'x','y') # returns (2) splice(@a,@a,0,'x','y') # returns ()
They return different value(s) in both list and scalar context.
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^10: shift in list context buggy? (inconsistencies)
by LanX (Saint) on Nov 12, 2013 at 16:40 UTC | |
by BrowserUk (Patriarch) on Nov 12, 2013 at 18:23 UTC | |
|