Perl Create Hash From Array To Hashmap Javascript Interview Question