Re: Creating hash with multiple keys for an array

2004-08-08 Thread Edward WIJAYA
What have you done to find out? perldoc -f sort perldoc -q "sort an array" I think you also need to read up on data structures: perldoc perldsc Gunnar, It works! I can't express enough my gratitude for your help and patience. I apologize for having trouble you this far. Actually I d

Re: Creating hash with multiple keys for an array

2004-08-08 Thread Gunnar Hjalmarsson
Edward Wijaya wrote: my @AoH = ( { values => ['AGCAG','AGCCG','AGCCGGGCG','AGCCAGGAG'] }, { values => ['AGCGGAGCG','AGCCGAGGG','AGCGGAGGG'] }, ); for ( 0..$#AoH ) { $AoH[$_]->{ic} = compute_ic( @{ $AoH[$_]->{values} } ); } print Dumper @AoH; Thanks Gunnar, I managed to const

Re: Creating hash with multiple keys for an array

2004-08-07 Thread Edward WIJAYA
my @AoH = ( { values => ['AGCAG','AGCCG','AGCCGGGCG','AGCCAGGAG'] }, { values => ['AGCGGAGCG','AGCCGAGGG','AGCGGAGGG'] }, ); for ( 0..$#AoH ) { $AoH[$_]->{ic} = compute_ic( @{ $AoH[$_]->{values} } ); } print Dumper @AoH; Thanks Gunnar, I managed to construct the Array of Has

Re: Creating hash with multiple keys for an array

2004-08-07 Thread Gunnar Hjalmarsson
Edward Wijaya wrote: I just realize that hash table can only return the values of "unique" key. And the compute_ic() function computes numbers that are not unique, so they can't be hash keys, I see. You have a new problem. We don't know much about the bigger picture here. Would possibly an array of

Re: Creating hash with multiple keys for an array

2004-08-07 Thread Edward WIJAYA
Thanks so much for your reply Gunnar. However there is a bit complication. I just realize that hash table can only return the values of "unique" key. Please try to execute the code below along with the attached file, and the target answer below for clarity, (the current code return the deviated ans

Re: Creating hash with multiple keys for an array

2004-08-07 Thread Gunnar Hjalmarsson
Edward Wijaya wrote: Thanks so much for your reply Gunnar, The purpose is as follows. For example these lines: AGCAG,AGCCG,AGCCGGGCG,AGCCAGGAG 15.188721875540 AGCGGAGCG,AGCCGAGGG,AGCGGAGGG 16.163408331891 \_/ \_/ @Array1

Re: Creating hash with multiple keys for an array

2004-08-06 Thread Edward WIJAYA
Thanks so much for your reply Gunnar, The purpose is as follows. For example these lines: AGCAG,AGCCG,AGCCGGGCG,AGCCAGGAG 15.188721875540 AGCGGAGCG,AGCCGAGGG,AGCGGAGGG 16.163408331891 \_/ \_/ @Array1

Re: Creating hash with multiple keys for an array

2004-08-06 Thread Gunnar Hjalmarsson
Edward Wijaya wrote: Is there anyway in Perl to create hash with multiple key for an array? Yes. my %HoA = ( key1 => [ @array1 ] ); $HoA{key2} = $HoA{key1}; The purpose is as follows. For example these lines: AGCAG,AGCCG,AGCCGGGCG,AGCCAGGAG 15.188721875540 AGCGGAGCG,AGCCGAGGG,AGCGGA