|Do you know where your variables are?|
Storing simple Value Pairsby raybies (Chaplain)
|on Oct 19, 2011 at 18:39 UTC||Need Help??|
raybies has asked for the
wisdom of the Perl Monks concerning the following question:
Suppose I want an array of value pairs, suppose for the sake of arguments, vertices, like X,Y (though, they don't have to be numeric types, I'm thinking generic pairs). I want to keep the list of vertices in a list.
What's the best way to store/organize them in perl?
It seems so wasteful to use an array of hashes (key/value) for a single pair, with key names like X and Y.
And using the first (X) value as a key wouldn't work if you needed to repeat the value.
Of course, a simple array of arrays would work...
I guess I'm curious what y'all do?
I mean, besides making an object, which is a pain for something this simple, especially if I don't supplement my Perl with something like Moose, which I don't... (well maybe it's not a pain for you... but I'm pretty weak there...) ;)