On Wed, Oct 12, 2005 at 02:18:12AM -0700, Yitzchak Scott-Thoennes wrote: > I think the problem is that that the first executed (of two) rv2av is > getting the OPf_REF flag set, when IMO it shouldn't. $#{@x} *is* > valid syntax; it should return $# of the array symbolically referred > to by @x, like this: > > $ perl -we'*1 = [qw/foo bar baz/]; @x=0; print $#{0+@x}' > 2 > > only without the 0+ being there. (If @x is lexical, then it's padav > that has the troublesome OPf_REF.) It's because Perl_ref() recursively sets the OPf_REF flag in the following in perly.y: | arylen %prec '(' /* $#x, $#{ something } */ { $$ = newUNOP(OP_AV2ARYLEN, 0, ref($1, OP_AV2ARYLEN));} That particuar problem can be fixed by replacing the call to ref() above with a direct $1->op_flags |= OPf_REF, but that doesn't solve the more general problem with things like push @{@a}, ...., which also gets the recursive Perl_ref() treatment. Possibly it can be fixed in Perl_ref()? -- Art is anything that has a label (especially if the label is "untitled 1")Thread Previous | Thread Next