1nickt has asked for the wisdom of the Perl Monks concerning the following question:
Hi all, in answering a question today I cam upon something that puzzled me. First:
$ perl -Mstrict -wle"my %hash; @hash{'array'} = 'foo';" Scalar value @hash{'array'} better written as $hash{'array'} at -e lin +e 1. $
... which is what I expected. But then:
$ perl -Mstrict -wle"my %hash; my @array; @hash{@array} = 'foo';" $
Why doesn't Perl have a warning for the latter case?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using a hash with the @ sigil
by choroba (Cardinal) on Jul 24, 2015 at 23:41 UTC | |
by 1nickt (Canon) on Jul 25, 2015 at 01:05 UTC | |
by Anonymous Monk on Jul 25, 2015 at 14:25 UTC | |
|
Re: Using a hash with the @ sigil
by AnomalousMonk (Archbishop) on Jul 24, 2015 at 23:50 UTC | |
|
Re: Using a hash with the @ sigil
by stevieb (Canon) on Jul 24, 2015 at 23:43 UTC | |
|
Re: Using a hash with the @ sigil
by Paladin (Vicar) on Jul 24, 2015 at 23:42 UTC | |
|
Re: Using a hash with the @ sigil
by 1nickt (Canon) on Jul 26, 2015 at 19:04 UTC |