Useful, but the hidden use of a global variable is a drawback. And other ways to do it involve adding more syntax than I think the feature warrants. But I'll throw out my ideas anyway.
- Adverb on the loop keyword
- print "$_ at index $counter\n" for :counter(my $counter) @x;
- Attribute on a variable
my $counter:loopcounter; # automatically used for all loops in the inn
+ermost scope
print "$_ at index $counter\n" for @x;
print "$_\n" for @y;
print "\@x and \@y had $counter total elements\n";