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

[perl #75888] Assignment expands arrays

Thread Next
From:
James E Keenan via RT
Date:
March 28, 2012 18:45
Subject:
[perl #75888] Assignment expands arrays
Message ID:
rt-3.6.HEAD-4610-1332985496-1161.75888-15-0@perl.org
On Sun Jun 20 05:11:12 2010, yecril71pl wrote:
> This is a bug report for perl from giecrilj@stegny.2a.pl,
> 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
> PERLOP(1)
> 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
https://rt.perl.org:443/rt3/Ticket/Display.html?id=75888

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About