|XP is just a number|
Using aliases in for loops or not?by jkva (Chaplain)
|on Feb 17, 2005 at 08:57 UTC||Need Help??|
jkva has asked for the
wisdom of the Perl Monks concerning the following question:
UPDATE : Got the description of the variable wrong.
Monks of the perl code,
this humble novice once more would request you to look up from your tomes and spare this unworthy son a few moments of your valuable time.
For some time now, I find myself among your midst. When I first came in here, I donned my robe with pride and shared much interesting times in this monastery, which has become my home away from home, and I have gained much knowledge.
Though still, from time to time, I notice small errors in my code. They are not fatal, wise ones, yet they are inefficient use of code which could be great, if only for knowledge I yet not posess.
Earlier today, I discovered such an error. It was as such:($data is a reference to an array of references to arrays)
This is how my code used to be. Today, to see if it could be done, I wrote this:
Which, to my surprise, worked!. This proves all my previous code could contain these horrid unefficiencies.
I have been taught the holy verse of TMTOWTDI, but still, this I must ask, where lie the boundaries of efficient and inefficient code? Was this bad code? What should be paid attention to when writing code?
I realize that this question addresses a very broad spectrum, which I ask your forgiveness for. Still, I felt I had to ask it. I must learn in order to know.
Your fellow scribe,