cdarke has asked for the wisdom of the Perl Monks concerning the following question:
(Windows ActiveState 5.10.1)use warnings; use strict 'subs'; my %hash = qw (k1 v1 k2 v2 k3 v3); $hash{k1} = 42; # is fine @hash{k1,k2,k3} = (1,2,3); # BANG! Bareword "k1" not allowed... @hash{qw(k1 k2 k3)} = (1,2,3); # is fine
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unquoted hash slice keys with use strict 'subs'
by JavaFan (Canon) on Oct 14, 2009 at 10:58 UTC | |
by cdarke (Prior) on Oct 14, 2009 at 11:28 UTC | |
by JavaFan (Canon) on Oct 14, 2009 at 11:57 UTC | |
by ikegami (Patriarch) on Oct 14, 2009 at 14:46 UTC | |
|
Re: Unquoted hash slice keys with use strict 'subs'
by moritz (Cardinal) on Oct 14, 2009 at 10:36 UTC | |
|
Re: Unquoted hash slice keys with use strict 'subs'
by Bloodnok (Vicar) on Oct 14, 2009 at 11:13 UTC | |
|
Re: Unquoted hash slice keys with use strict 'subs'
by ikegami (Patriarch) on Oct 14, 2009 at 14:33 UTC | |
|
Re: Unquoted hash slice keys with use strict 'subs'
by ikegami (Patriarch) on Oct 14, 2009 at 17:22 UTC |