Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

autovivication of an assignement

0 views
Skip to first unread message

Ton Hospel

unread,
Feb 18, 2004, 10:47:21 AM2/18/04
to perl5-...@perl.org
Why doesn't this actually work:

perl -e '$x = ($u=undef)->{foo}'
Can't use an undefined value as a HASH reference at -e line 1.

while this is (of course) fine:

perl -e '$u = undef; $x = $u->{foo}'

isn't the result of an assignment supposed to be a proper lvalue ?

perldoc perlref definitely discusses autovivication in terms of
lvalues, so this feels like a bug to me.

Nicholas Clark

unread,
Feb 18, 2004, 3:39:54 PM2/18/04
to Ton Hospel, perl5-...@perl.org

I think it's a bug. I think it's probably bug 18635, or at least related
to this bug.

Rafael summarised the thread that I'm thinking about here:

http://dev.perl.org/perl5/list-summaries/2002/p5p-200211-4.html

xray threads better than that summary's link, and Rafael's summary table is
here:

http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2002-11/msg00855.html


I've not had the tuits TODO it yet :-(

Nicholas Clark

Ton Hospel

unread,
Feb 18, 2004, 6:55:40 PM2/18/04
to perl5-...@perl.org
In article <20040218203953.GW46380@plum._lirble.org>,

Nicholas Clark <ni...@ccl4.org> writes:
> On Wed, Feb 18, 2004 at 03:47:21PM +0000, Ton Hospel wrote:
> I think it's a bug. I think it's probably bug 18635, or at least related
> to this bug.
>
> Rafael summarised the thread that I'm thinking about here:
>
> http://dev.perl.org/perl5/list-summaries/2002/p5p-200211-4.html
>
> xray threads better than that summary's link, and Rafael's summary table is
> here:
>
> http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2002-11/msg00855.html
>
>
> I've not had the tuits TODO it yet :-(
>
> Nicholas Clark

This is without "use strict" at all though, so it looks different to me.
I'll perlbug it so it at least doesn't get lost.

0 new messages