in reply to stumped on a complex data structure

UPDATE: Ignore this. I misread the question. (The question at the bottom's still valid though).

my %HoA = ( 0=>[ 1, 2, 3 ], 1=>[ 4, 5, 6 ], 2=>[ 7, 8, 9 ] ); print join'', map @{ $HoA{ $_ } },sort{$a<=>$b} keys %HoA; 123456789

One point. If your hash keys are consecutive integers starting from 0, why use a HoA and not a AoA?


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail        "Time is a poor substitute for thought"--theorbtwo
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

Replies are listed 'Best First'.
Re^2: stumped on a complex data structure
by ikegami (Patriarch) on Nov 15, 2004 at 19:43 UTC
    Shouldn't the output be 147258369?

      Updated. Thanks.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail        "Time is a poor substitute for thought"--theorbtwo
      "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
        Thank you Oh Wise Ones for your comments. Since I've never used a HofA or AofA before, I just picked one. The AofA solution appears to be easier, so I'll probably use that for the final code.

        To help me undertand how both flavors of lol work, I think I'll try it both ways & benchmark each.

        I bow to your collective Wisdom...........

      Yes, this is what I'm looking for. Haven't got it working yet, but have dim glimmer on how this stuff works. am starting to understand how to bump thru this data structure.