http://www.perlmonks.org?node_id=577794

PerlingTheUK has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks, I have just found a bug where a code was:
%locations = map{ $_ => 1 } ( @locations );
but should have done
%locations = map{ $_ => 1 } ( @locations, keys %locations );
Now I think that this setup is really annoying, easpecially as I would like rewrite it so that every value is counted to represent how often a location has been added. Is there a way to add onto the old hash instead of completely rewriting it?

Cheers,
PerlingTheUK