in reply to
Re: c-like struct?
in thread c-like struct?
I have many pieces of sorted data to use like below:
['US', 23, 'Andy', 'adress....' ]
['CA', 34, 'White', '........' ]
I'd like to crate a structure like c struct to be self description of every element meaning:
In this case, I think a hash is not appropriate because
- hash is unsorted, but the order of elements of data is fixed
- I will never pick some elements in a struct to use. Every time, I manipulate a whole struct as a piece of data, copy, delete, print etc.
Now, my way is to add a comment to show sequence of elements by the end of statement:
my @struct = () #(state, age, name, ....)
But I'd like to know if there is a better way to reach this.
I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction