in reply to Re: How to populate a HASH using a FOR loop to a FUNCTION
in thread How to populate a HASH using a FOR loop to a FUNCTION

... populating the hash really takes just 1 line of code ...

E.g., for the given example data of the OP:

c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "my @array = qw( sean connery george lazenby roger moore timothy dalto +n pierce brosnan ); my %myHash = @array; dd \%myHash; " { george => "lazenby", pierce => "brosnan", roger => "moore", sean => "connery", timothy => "dalton", }

Replies are listed 'Best First'.
Re^3: How to populate a HASH using a FOR loop to a FUNCTION
by Laurent_R (Canon) on Dec 25, 2014 at 11:40 UTC
    Sure, you're right. I wanted to start keeping the OP's general architecture while fixing its defects, and then to simplify it in two steps. I originally thought of completing my post with a direct assignment as you did, but I forgot to do it when completing the post. Thanks for doing it. This is of course the easiest solution.