develooper Front page | perl.perl5.porters | Postings from April 2013

[perl #117729] "splice() offset past end of array" warning doesn't always appear

Thread Next
Karen Etheridge
April 25, 2013 03:41
[perl #117729] "splice() offset past end of array" warning doesn't always appear
Message ID:
# New Ticket Created by  Karen Etheridge 
# Please include the string:  [perl #117729]
# in the subject line of all future correspondence about this issue. 
# <URL: >

According to the splice documentation in perlfunc:

   splice ARRAY or EXPR,OFFSET

   If OFFSET is past the end of the array, Perl issues a warning, and
   splices at the end of the array.

    perl -wle'use warnings FATAL => "all"; my @arr = qw(0 .. 10); splice(@arr, 20); print "ar is @arr"'

This generates a warning on some versions/architectures and not others.
Based on the versions tested, this appears to have regressed between 5.14.3
and 5.16.0.

5.8.9 darwin OSX 10.6.8
5.14.2 darwin OSX 10.6.8
5.14.3 darwin OSX 10.6.8
5.14.3 linux CentOS

no warning:
5.16.0 linux ubuntu
5.16.0 darwin OSX 10.6.8
5.16.1 darwin OSX 10.6.8
5.16.3 darwin OSX 10.6.8
5.17.11 darwin OSX 10.6.8

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About