the code is currently working and i've used data::dumper to confirm my data structure. $array is used later in code not shown as it is not relevant to the question.
it sounds like you don't have an alternative to hardcoding the dimensions, either! that's good to know, maybe my solution is the only way....
| [reply] |
$array is used later in code not shown as it is not relevant to the question.
How that array would be used or accessed, is obviously very relevant to how it would be built. Yes, your code seems fixable, but it's not impossible that your code had to be rewritten (so it's more elegance, or faster, or more readable, or more efficient, whatever your goal) if we knew more information about what it's prepared for.
it sounds like you don't have an alternative to hardcoding the dimensions, either!
Oh, I'm sorry to dissapoint you. Just because I don't provide it here doesn't mean I don't have one. The things is, I refused to do what you might expected me to do due the reason I gave here. I'm not as wise as many monks here, but I'm free to choose how or what I reply, and you're free to choose any reply that most suits you, as well.
And why do you think my reply was solely to solve your problem? The reason I posted here is so we (and it's not just you and me) can all learn from each other, both our mistakes and rightness. That's what, as far as I understand it, a community-based forum is for.
Immediate update: I forgot to say that.... Nevertheless, you actually present a pretty interesting situation I upvoted the node.
Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!
| [reply] |
the code is currently working and i've used data::dumper to confirm my data structure. $array is used later in code not shown as it is not relevant to the question. it sounds like you don't have an alternative to hardcoding the dimensions, either! that's good to know, maybe my solution is the only way....
Well, for one thing it's important to always remind that true multidimensional arrays do not exist (yet). Re dimensions, it's not strictly true that you have to hardcode them. Indeed D::D and similar modules themselves are the proof that it is possible not to. You have to navigate through the structure. Either recursively or possibly iteratively, as a recent and extremely interesting post shows. (But the technique shown there has to do with cloning and thus may be more complex than you actually need.) It all really depends on what you really want to do.
| [reply] |