in reply to Force access a Hash ref as Array ref

"I know that's not an ARRAY ref, but since I want to learn the appear order"

Hashes in Perl aren't ordered. As soon as you put things in a hash, whatever order the keys and values were listed in has already gone.

The workaround you describe is the best option. Passing a tied hash which maintains order is also a possibility, but results in more work for your caller, and slower performance.

  • Comment on Re: Force access a Hash ref as Array ref