http://www.perlmonks.org?node_id=874062

szabgab has asked for the wisdom of the Perl Monks concerning the following question:

use strict; use 5.010; foreach my $word (qw(abc def ghi)) { say $word; }
When using strict perl requires to declare even the loop variable of a foreach loop. Why is that? After all the $word variable in the above example is an alias to the values and won't have any effect outside of the loop. Even if written this way:
use strict; use 5.010; my $word = "hello"; foreach $word (qw(abc def ghi)) { say $word; } say $word; # word is "hello" here
Why is this code not allowed?
use strict; use 5.010; foreach $word (qw(abc def ghi)) { say $word; } # generate syntax error if $word is used here