Creating hash with multiple keys for an array

From: Edward Wijaya (ewijaya_at_singnet.com.sg)
Date: 08/06/04


To: beginners@perl.org
Date: Fri, 06 Aug 2004 23:20:16 +0800

Hi,

Is there anyway in Perl to create
hash with multiple key for an array?

The purpose is as follows.

For example these lines:

AGCGGGGAG,AGCGGGGCG,AGCCGGGCG,AGCCAGGAG 15.188721875540
AGCGGAGCG,AGCCGAGGG,AGCGGAGGG 16.163408331891
\_____________________________________/ \_____________/
       @Array1 $Key1

I want to store @Array1 under hash with $Key1 AND
scalar(@Array1) as $Key2.

Because later I need to sort the hash
based on $Key1 and $Key2.

Thanks so much for your time.

Regards,
Edward WIJAYA
SINGAPORE



Relevant Pages

  • Non-uniques keys
    ... Is there a way to store the value of non-unique key value. ... hash that with key values key1 key2..and so on. ...
    (perl.beginners)
  • Re: Non-uniques keys
    ... Is there a way to store the value of non-unique key value. ... I have a hash that with key values key1 key2..and so on. ...
    (perl.beginners)
  • Re: processing a hash of a hash of a hash
    ... processing a hash of a hash of a hash ... - Use of uninitialized value in hash element at ./clearwhite.pl line 522. ... foreach $key1 { ... foreach $key { ...
    (perl.beginners)
  • processing a hash of a hash of a hash
    ... I am trying to print out a hash of a hash of a hash table(with code ... foreach $key1 { ... foreach $key (keys %top){ ...
    (perl.beginners)
  • Re: bad code, needs work...
    ... > The problem I am getting is checking to see if one field matches the city, ... The outfile opens can be handled in a loop that will at least prevent ... then store that scalar into a hash, which would be a convenient way to ... Again if you store the output handles to a hash, ...
    (perl.beginners)