in reply to converting ana array to a hash


The best way to do this is via a hash slice.

In the first example the hash values will all be undef*. To assign a value to all the keys you can use the second method:

my @a = (1..9); my %h; # hash slice @h{@a} = (); # Same thing but sets each value to 1 @h{@a} = (1) x @a;

Hash, and array, slices are explained in perldata.

--
John.

* It is worth noting that the assignment in the first example is only to the hash value associated with the first element of the array.