It doesn't look like shift has a list context, at least according to perldoc. That makes some sense, since it can only return one thing,
unlike splice, which can return zero to many.
I'd use
while( @x ) { print shift @x, ',' }
for your last example.
In reply to Re: shift on empty array in list context broken
by tybalt89
in thread shift on empty array in list context broken
by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |