prafull has asked for the wisdom of the Perl Monks concerning the following question:

Hi

How do I make an array as keys of hash without loop
through an array ?

Regards,
Prafull

Replies are listed 'Best First'.
Re: keys of hash
by moritz (Cardinal) on May 18, 2010 at 10:10 UTC
    with keys. Or do you mean something else? If yes, what?
      I have an array with some values. I want to make elements
      of an array as keys of hash. For this, ideal
      process is that loop through an array and insert array
      elements into keys of hash one by one.
      Is it possible to make this in one line ( i mean w/o loop)?

      Regards,
      Prafull
        Yes, it is possible:
        my %hash; @hash{@array} = ();
        This will make your list unique since a hash cannot have duplicate keys.