develooper Front page | perl.perl5.porters | Postings from May 2004

Re: my $x->{foo} doesn't work

Thread Previous | Thread Next
Elizabeth Mattijsen
May 21, 2004 09:35
Re: my $x->{foo} doesn't work
Message ID:
At 23:09 +0900 5/21/04, Shinya Hayakawa wrote:
>On Friday 21 May 2004 5:47 pm, Rafael Garcia-Suarez wrote:
>>  If you look at what contexts permit and forbid autovivification, you'll
>>  see that the situation in perl is currently complex and probably not
>>  very consistent. Anyway, in general lvalue contexts don't permit it; a
>>  lexical declaration can be seen as this;
>The current Perl sourcecode may incorporate a mistake in OPpDEREF
>what I did before(like OPpLVAL_INTRO).
>>  and you still can write, in a
>>  rather obfuscated way,
>>      (my $x = {}) -> {foo}
>What you proposed is exactly what I have been doing but
>there is nothing I can do apart from the above :-)
>If this is successful I will rather prefer to write as follows:
>++my $x->{foo} if cond();

my $x if cond()

is a Perl idiom that currently has an undefined behaviour.  Unless 
someone cleaned that up in the past weeks (while I was recovering 
from a death in the family and a dead notebook).


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