in reply to Re: using "my" in hash slice
in thread using "my" in hash slice

If you had written @a{(undef) } = () you'd have gotten the same result.
But (undef) and () are the different things. The first one is not empty list, but the second one is empty.
BTW the following code gives the identical results with all versions of the perl (no warninigs, empty hash)
perl -wle 'use Data::Dumper; my %a; @a{()} = (); print Dumper(\%a)'

Replies are listed 'Best First'.
Re^3: using "my" in hash slice
by PodMaster (Abbot) on Jun 18, 2004 at 11:07 UTC
    Ok, so I misspoke. It seems that in that particular context the empty list is being upgraded to an empty string, which I guess would count as a bug.
    update: Seeing how the example is pretty dumb, I wouldn't count it as much of a bug :)(its probably trivial to fix, but its just so dumb it wouldn't matter if its never fixed) At least this does the right thing :
    perl -wle 'use Data::Dumper; my %a; @a{my @b,1} = (); print Dumper(\%a +)' perl -wle 'use Data::Dumper; my %a; @a{my @b,1} = (1,2); print Dumper( +\%a)'

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.