sub foo { my $i; for $i (...) { ... if (...) { my $i; $i = something; ... } } }