in reply to Interesting (split) oddity with 5.6.1, fixed in 5.8.0

That's a real complicated set of factors required to caused the bug manifest.

The simplest I've been able to reduce it to is

sub list{ ( '1', '2', '3', '4', '5' ) } print @a=( list() )[0,0];

From what I can work out, the following circumstances are required

  1. The list slice has to try to recover the same element twice.
  2. The result of the list slice has to be assigned to an array.
  3. The list has to be the result of a function --built-in or user.
  4. The list has to be a list of strings rather than numbers!! Ie. (1,2,3,4,5) won't cause it, but ('1','2','3','4','5') will, if the other circumstances are present.

Removing any one of these factors and the bug doesn't occur.

sub list{ ( 1, 2, 3, 4, 5 ) } print @a=( list() )[0,0]; 11 sub list{ ( '1', '2', '3', '4', '5' ) } print +(l())[0,0] 11 sub list{ ( '1', '2', '3', '4', '5' ) } print @a=( list() )[0,1]; 12 print @a=( list() )[1,0]; 21 sub list{ ( '1', '2', '3', '4', '5' ) } print @a=( list() )[0,0]; 1 Use of uninitialized value in print ...

It would be interesting to know if this was fixed accidently for 5.8.0, or whether someone sat down and tracked down the cause from the symptoms. If it was the latter, that would have been one educational debugging session to have watched.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
Hooray!