in reply to shift on empty array in list context broken
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.
|
|---|