Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Force access a Hash ref as Array ref

by tobyink (Canon)
on Jul 20, 2021 at 06:45 UTC ( #11135197=note: print w/replies, xml ) Need Help??

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

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11135197]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2022-01-29 05:49 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (74 votes). Check out past polls.