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!


In reply to Re: Interesting (split) oddity with 5.6.1, fixed in 5.8.0 by BrowserUk
in thread Interesting (split) oddity with 5.6.1, fixed in 5.8.0 by RMGir

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.