Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
a git bisect shows the first bad commit is 4ecee209 (the first release that contains this commit appears to be v5.21.5)
The bisect is misleading; the issue is with split when it is optimised to split directly to an array (rather than just returning a list which later gets assigned to something). When exactly this optimisation is enabled has changed between releases, and that commit is one of those changes.

The real issue was introduced in perl 5.19.4, and I've just fixed in it in blead with this commit:

commit 71ca73e5fa9639ac33e9f2e74cd0c32288a5040d Author: David Mitchell <davem@iabyn.com> AuthorDate: Wed Nov 30 08:59:01 2016 +0000 Commit: David Mitchell <davem@iabyn.com> CommitDate: Wed Nov 30 09:11:25 2016 +0000 split was leaving PL_sv_undef in unused ary slots This: @a = split(/-/,"-"); $a[1] = undef; $a[0] = 0; was giving Modification of a read-only value attempted at foo line 3. This is because: 1) unused slots in AvARRAY between AvFILL and AvMAX should always +be null; av_clear(), av_extend() etc do this; while av_store(), if st +oring to a slot N somewhere between AvFILL and AvMAX, doesn't bother to +clear between (AvFILL+1)..(N-1) on the assumption that everyone else pla +ys nicely. 2) pp_split() when splitting directly to an array, sometimes over- +splits and has to null out the excess elements; 3) Since perl 5.19.4, unused AV slots are now marked with NULL rat +her than &PL_sv_undef; 4) pp_split was still using &PL_sv_undef; The fault was with (4), and is easily fixed.

Dave.


In reply to Re^2: split problem by dave_the_m
in thread split problem by rmarkman

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-19 03:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found