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

slice autoextending ?

Thread Next
Dave Mitchell
April 22, 2003 15:35
slice autoextending ?
Message ID:
bugid #1832 points out that there is an inconsistency between the docs and
the behaviour of splice, in that the array isn't autoextended if
the offset is off the end; eg

    perl -le 'splice(@x,10,1,'foo'); print 0+@x'

prints 1 rather than 10.

The bug dialogue contains proposals both for a doc patch or a code patch,
but no concensus was reached (or even attempted, it would appear) as to
which it should be.

I would vote for fixing the docs.
Any dissenters?

A walk of a thousand miles begins with a single step...
then continues for another 1,999,999 or so.

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