On Sat Oct 18 18:05:45 2008, ikegami@adaelis.com wrote: > On Fri, Oct 17, 2008 at 11:26 AM, via RT Ed Avis > <perlbug-followup@perl.org>wrote: > > > # New Ticket Created by "Ed Avis" > > # Please include the string: [perl #59956] > > # in the subject line of all future correspondence about this issue. > > # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=59956 > > > > > > > This is a bug report for perl from eda@waniasset.com, > > generated with the help of perlbug 1.36 running under perl 5.10.0. > > > > > > ----------------------------------------------------------------- > > [Please enter your report here] > > > > This test program > > > > $a[1][0] = 'x'; > > sub f { grep { grep { 0 } @$_ } @_ } > > f @a; > > > > produces the error > > > > Modification of a read-only value attempted at prog line 2. > > > > However no modification of any value was asked for. The error message > > should state more clearly what is happening. > > > > The read-only value in question is the undef at $a[0]. > The attempt to modify it is autovivification via @$_. > > The correct code would be > sub f { grep { grep { 0 } $_ ? @$_ : () } @_ } > or the slightly wasteful > sub f { grep { grep { 0 } @{ $_ || [] } } @_ } > > Surely the error message could be improved? There have been no responses to Eric's post or the original post in more than four years. Does anyone feel this issue should be taken on? If not, the absence of discussion in that period of time suggests the ticket can be closed. Thank you very much. Jim Keenan --- via perlbug: queue: perl5 status: open https://rt.perl.org:443/rt3/Ticket/Display.html?id=59956Thread Next