Hi,

I am looking for help to retrieve from a Hash of Hashes in insertion
order? I am not an expert in multi-dimensional Hashes, how could I use
Tie::IxHash module with a sub-Hash, if I could?

Here is an example, I want to retrieve from sub-hash
%{$dir_contents->{$item}  in the insertion order. I want to first print
key and value for "template_id", then "trace_name", then "trace_file",
and so on...

    foreach my $item (keys %$dir_contents ) {
       print "$item\n";
       foreach my $k (keys %{$dir_contents->{$item}} ) {
           print "  $k => $dir_contents->{$item}{$k}\n";
       }
    }


Here is sub that I am using to build the HoH:

        my %trace_info = ();
        while( my $f = readdir( DIR )) {
            $count++;
            next if( $f eq '.' or $f eq '..' );
            my($template) = ($f =~ /(\d+[A-Z][A-Z]*)[0-9]*/);
            my($tracename) = ($f =~ /\d+([A-Z][A-Z]*[0-9]*)[a-z]/);
            ...
            ...
            $trace_info{$count}{'template_id'} = $template;
            $trace_info{$count}{'trace_name'} = $tracename;
            $trace_info{$count}{'trace_file'} = $tracefile;
            $trace_info{$count}{'trace_format'} = $traceformat;
            $trace_info{$count}{'trace_end'} = $tracedirection;
         }
      return \%trace_info;

Thanks,
perdeep

Perdeep Mehta
Hartwell Center for Bioinformatics & Biotechnology
St. Jude Children's Research Hospital
Memphis, TN 38105-2794
Tel: 901-495 3774
http://www.hatwellcenter.org/


_______________________________________________
Perl-Unix-Users mailing list
Perl-Unix-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to