develooper Front page | perl.perl5.porters | Postings from March 2012

[perl #75888] Assignment expands arrays

Thread Next
James E Keenan via RT
March 28, 2012 18:45
[perl #75888] Assignment expands arrays
Message ID:
On Sun Jun 20 05:11:12 2010, yecril71pl wrote:
> This is a bug report for perl from,
> generated with the help of perlbug 1.36 running under perl 5.10.0.

> The documentation on assignment operator is incomplete.
> PERLOP(1)              Perl Programmers Reference Guide
> Assignment Operators
>        "=" is the ordinary assignment operator.
>        Assignment operators work as in C.  That is,
> No, they do not, in one special case:
> #!/usr/bin/perl -w
> use strict; use warnings; my @a; ($a [01000], $,, $\) = (0, ',', '
> '); print @a;
> This code, mutatis mutandis, smashes the stack in C.
> OTOH, the assignment to an array element that is off-bounds causes
> Perl to
> expand the array, and wastes memory if the index of the element is
> large.
> AFAIK, this behaviour is described nowhere in perl documentation.  It
> is also
> different from how it works in shell or in javascript so I think it
> would be
> worth saying.
> [Please do not change anything below this line]

I recommend that this ticket be closed.  No patch was ever submitted,
and in other RTs we can find patches for the same section in 'perlop'
discussed in this ticket.

Thank you very much.
Jim Keenan

via perlbug:  queue: perl5 status: open

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