Thanks so much for your reply Gunnar,
The purpose is as follows.
For example these lines:
AGCGGGGAG,AGCGGGGCG,AGCCGGGCG,AGCCAGGAG 15.188721875540 AGCGGAGCG,AGCCGAGGG,AGCGGAGGG 16.163408331891 \_____________________________________/ \_____________/ @Array1 $Key1
Is that an array with 7 elements?
No. They are 2 arrays each with 4 elemeents and 3 elements. For this I want to store them in hash of array.
What do you mean by the scalar variable $Key1 that points to 2 numbers?
What I mean by scalar of variable is : $Key2=scalar(@Array1) i.e the number of elements of that array.
So $Key2 for line1 = 4, and $Key2 for line2 = 3
I want to sort the hash based on this value as well as $Key1.
Okay. If I understand you correctly, you don't need any additional keys to be able to sort by number of elements in the arrays, since that info is still conveniently available.
my %HoA = ( '15.188721875540' => [ 'AGCGGGGAG','AGCGGGGCG','AGCCGGGCG','AGCCAGGAG' ], '16.163408331891' => [ 'AGCGGAGCG','AGCCGAGGG','AGCGGAGGG' ], );
print "Sorted by keys\n"; for ( sort { $a <=> $b } keys %HoA ) { print "$_: @{ $HoA{$_} }\n"; }
print "\n";
print "Sorted by number of elements\n"; for ( sort { @{ $HoA{$a} } <=> @{ $HoA{$b} } } keys %HoA ) { print "$_: @{ $HoA{$_} }\n"; }
-- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>