in reply to Re^2: c-like struct?
in thread c-like struct?

Why would the "perl way" of using an AoH not work?

my @data = ( { state => 'US', age => 22, name => 'Andy', ... }, { state => 'CA', age => 34, name => 'White, ... }, );

Is there some action that you are having problems with, or is the representation just not C-like?

--MidLifeXis

Replies are listed 'Best First'.
Re^4: c-like struct?
by xiaoyafeng (Deacon) on Jun 24, 2011 at 14:01 UTC
    the most difference is hash is not sorted, array is.




    I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

      What is the use case where having the data sorted is important? If you are serializing your data, you have a serialization function (could even be pack). How it is stored in memory seems to me to be a detail that is a "don't care" in most circumstances, and is possibly a premature optimization.

      --MidLifeXis