in reply to Please correct my sorting in this HoA

Sorry, I obviously have a HoH and not HoA as I erroneously state in my title :)
  • Comment on Re: Please correct my sorting in this HoA

Replies are listed 'Best First'.
Re^2: Please correct my sorting in this HoA
by Anonymous Monk on Oct 17, 2022 at 00:14 UTC
    Found it:
    foreach my $id ( sort keys %HoH ) { print ">$id: \n"; for my $pos ( sort { $a <=> $b } keys $HoH{$id}->%* ) { print "$pos:$HoH{$id}{$pos}\n"; } print "\n";
      Your syntax looks a bit odd to me. I would code thusly (as personal preference):

      foreach my $id ( sort keys %HoH ) { print ">$id: \n"; for my $pos ( sort { $a <=> $b } keys %{$HoH{$id}} ) { print "$pos:$HoH{$id}{$pos}\n"; } print "\n"; }