Home > front end >  Do latter keys in an hash assignment from an array always override earlier keys?
Do latter keys in an hash assignment from an array always override earlier keys?

Time:05-23

Given this:

%h = (a => 3, b => 4, a => 5);

Imperically $h{a} == 5 holds true, but are there cases where $h{a} == 3 because of internal dictionary hashing or some other perl-internal behavior?

Another way to ask: Does perl guarantee to keep key-ordering the same when assigning an array to a hash, even in the event of a key collision?

Duplicates key entries are convenient for things like %settings = (

  • Related