in reply to Hash not getting updated
I assume this is just contrived code to ask a question, but, just in case, a hash slice makes the 'foreach' block unnecessary.
my @array = ( 'white', 'blue', 'yellow' ); my %hash; @hash{ @array } = @array;
Or, without the array:
my %hash; @hash{ 'white', 'blue', 'yellow' } = ( 'white', 'blue', 'yellow' );
In Section
Seekers of Perl Wisdom