in reply to Why does an array "dissolve" into a hash?
Hello Cody Fendant,
As LanX says, it’s a list assignment. So
my %h = (foo => 100, bar => 333, san => @a);
is actually
my %h = ('foo', 100, 'bar', 333, 'san', '8', 'foo', '666');
The second assignment to key foo overwrites the first, so when the assignment is complete, $h{foo} is '666'.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why does an array "dissolve" into a hash?
by Cody Fendant (Hermit) on Aug 20, 2015 at 03:54 UTC | |
by ikegami (Patriarch) on Aug 20, 2015 at 13:37 UTC | |
by Anonymous Monk on Aug 20, 2015 at 06:34 UTC |