laziness, impatience, and hubris | |
PerlMonks |
Re: (2) Thoughts on naming loop LABEL: (Why I name hash vars singular. Why label loops?)by ybiC (Prior) |
on May 02, 2002 at 14:41 UTC ( [id://163549]=note: print w/replies, xml ) | Need Help?? |
Good question, dreadpiratepeter - I suppose it's largely a matter of taste. I only meant to preface my question with examples of my currently preferred naming style, not say that mine is necessarily better than any others. I'm sure there are other threads on the matter, but only have time for a superficial Search, which turned up Sinister's recent Plural variable naming (or not?).
I forgot to ask the probably greater question that AM points out below - *why* would one choose to LABEL: a loop? cheers,Don striving toward Perl Adept (it's pronounced "why-bick")
Update: Now that I've a bit of time, I'll try to es'plain my naming preference of singular-for-a-hash-var: It seems to boil down to what looks more clear in the context of how I most commonly employ the variable types in my code. In the following bogo-code, each $hash{key} is dealt with as an individual (singular) item.
Then in this next kind of hash usage, I still think of each $hash{key} as an individual item. And in the loop, the "keys" conveys the plurality of $hash{key}'s within the greater %hash. At least to me. Heh.
In Section
Seekers of Perl Wisdom
|
|