Subject: | Odd Array Lookups |
Date: | Thu, 31 May 2012 16:49:13 -0700 |
To: | bug-array-ashash [...] rt.cpan.org |
From: | "David E. Wheeler" <dwheeler [...] cpan.org> |
Given this script:
my $lines = Array::AsHash->new({ array => [
foo => 'David',
bar => 'Julie',
baz => 'Anna',
foo => 'Alex',
yow => 'Fred',
]});
say $lines->aindex('foo');
say $lines->key_at(2);
say $lines->key_at(6);
say $lines->value_at(3);
I expect this output:
6
baz
baz
Julie
What I see instead is:
6
baz
Alex
Huh? What does it thing "Alex" is value 3? And why does it not find the key "baz" at index 6, even though aindex() finds it there?
Thanks,
David