On Tue, Jan 28, 2003 at 12:30:41PM -0800, Austin Hastings wrote:
> 
> --- Michael Lazzaro <[EMAIL PROTECTED]> wrote:

> >      my int @a is Array( default => 5 );

> >      @a[0] = undef;
> 
> This should cause a blip of some kind. If storing an explicit undef (as
> opposed to "undef but 0" or C<$v = undef; @a[0] = $v;> there should be
> an exception. If storing an implicit undef: convert to int (IOW: 0) and
> emit a warning.
> 
> >      @a[0];         # 0, or 5?

I'm not sure. I think I like the idea of

  @a[0] = undef;

being a blip, but

  undef @a[0];

resetting the value to the default. Conceptually perl5 already has a
distinction between assigning undef to an aggregate, and passing an
aggregate to the undef operator:

$ perl -le '@a = %ENV; print scalar @a; undef @a; print scalar @a'
42
0
$ perl -le '@a = %ENV; print scalar @a; @a = undef; print scalar @a'
42
1

so it's not a great leap to extend this difference to scalar values.
Although it may be one leap too far.

Nicholas Clark

Reply via email to