|XP is just a number
Help with ADTby dimmesdale (Friar)
|on Jul 24, 2002 at 19:36 UTC
dimmesdale has asked for the wisdom of the Perl Monks concerning the following question:
Hmm... perl's ease has led me down a horrible path yet again. Well not so horrible, but you'll see.
I come from a C/C++ background, so when I want to create an ADT (advanced data type), I use struct or class. It's so easy.
I want to create a heterogenous data structure in perl, and I would appreciate some input -- currently I'm getting an error about coercing a hash into an array (or was it an array into a hash ... :)
Here's a quick summary of what I need:
For the invalid data, I thought that the value could be something like this --
Where 21 was the min, 27 the max, etc.
I'm not sure that any of that is needed by you, so I'll stop there.
However, my current method of referring to these data is as such:
My question to you: Is this, as I suspect, the source of the 'hash coercion problem'? and if so, what data type should I make ... possibly should I go all out and make a module with accessors and constructors and the full nine yards, etc.?
Your experience and help is most apprecieted. </CODE>
The actual things I need to keep track of are changing somewhat as I'm becoming aware of what I need ... your answer need not be too specific to the data I have, though it could.