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


in reply to Adding values from an array to a hash

You can do this:
@locations{@locations} = (1) x scalar @locations