On Tue, Jan 28, 2003 at 02:13:22PM -0800, Michael Lazzaro wrote: > Hmm. I don't have a strong preference either way, but I'm not sure why > (given C<my int @a>): > > @a[ undef ] > > C<undef> should be autoconverted to 0 with warning, but in: > > @a[0] = undef; > > C<undef> should _not_ be autoconverted to 0, but instead trigger an > exception. > > They're both in C<int> context, unless we want to make a special "int > being used as an array index" context that's different from normal > C<int> context. Seems like C<undef> should be treated like 0 (plus > warning) in numeric context either everywhere, or nowhere. (?)
Hmm. You've got me there. I don't have an answer that's consistent. Unless the context is allowed to govern whether undef conversion is allowable, or an exception. But that feels complex. I think the answer is "it depends", and some of the time I'd like each different permutation of behaviour. Nicholas Clark