in reply to Using Tie::IxHash to keep database query keys/values in order

What am i not understanding?

Probably $data = $self->dbh->selectall_arrayref is replacing the hash reference with a reference to a different hash that isn't tied.

But hashes don't have ordering, why do you need ordering? Just for printing?

Replies are listed 'Best First'.
Re^2: Using Tie::IxHash to keep database query keys/values in order
by bradcathey (Prior) on Feb 16, 2017 at 13:30 UTC

    Yes, I'm building a CSV file, but thanks to the comments above, I'm thinking of 1) writing my own loop, or 2) using Excel::Template. Funny how we get myopic and miss the forest.

    —Brad
    "The important work of moving the world forward does not wait to be done by perfect men." George Eliot

      Hi bradcathey,

      I'm building a CSV file

      If you use selectall_arrayref, that'll pull all the results from the database into memory. I imagine that fetching the results row by row with DBI's fetchrow_arrayref, the return value of which can be fed directly into Text::CSV's print method, would be more efficient.

      Regards,
      -- Hauke D