in reply to Splitting an array to populate hash
I think using a hash slice is the solution to your problem, the way broquaint uses it - it's just a bit hidden in his code so I'd like to highlight it.
Leaving out the problem of how to split out the keys and the value, this is how you assign multiple keys to one value in a hash: @hash{ @keys } = ( $value ) x @keys; In the more general version, this allows you to set multiple keys to multiple values in a hash: @hash{ @keys } = @values; The first example simply builds the array on the right-hand side on the fly by repeating the $value as many times as the length of the array @keys.
-- Hofmator
|
|---|