in reply to Adding values from an array to a hash
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?
I'm not really sure if I understand your question, but you probably either want
%locations=(%locations, map {$_ => 1} @locations);
or
$locations{$_}++ for @locations;
|
|---|