...
However, the loop treats the iteration variable $value as local. So when it exits the list, $value regains the value it had before the loop. Because it was uninitialized before the loop, it remains undefined afterwards, and the final print statement prints {{ is even}}:
| Code Block |
|---|
is even. |
Compliant Solution (Expanded Loop)
...
| [Conway 2005] | "Iterator Variables," p. 105 |
| [CPAN] | Elliot Shank, Perl-Critic-1.116 Variables::RequireLexicalLoopIterators |
| [Wall 2011] | perlsyn |
...