|
|
| "be consistent" | |
| PerlMonks |
Re: Dereference string in foreachby 7stud (Deacon) |
| on Feb 13, 2013 at 23:23 UTC ( #1018657=note: print w/ replies, xml ) | Need Help?? |
|
By the way, in "Perl Best Practices" Damian Conway advises that you should always write 'my' before your for-loop variable because if you don't : [The resulting] behaviour is contrary to all reasonable expectation. Everywhere else in Perl, when you declare a lexical variable, it's visible throughout the remainder of its scope, unless another explicit my declaration hides it. So it's natural to expect that the [variable] used in the for loop is the same lexical [variable] that was declared before the loop. But it isn't. ("Perl Best Practices", p. 108)
My code makes it neccessary to loop through an array and to output all elements using a reference. That doesn't seem to make a lot of sense:
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||