Possible Duplicate:
automatically get loop index in foreach loop in perl
I'd like to iterate over an array, but I need to keep track of the index. This code doesn't list the indexes as I'd expect - how can I fix it?
$arr = [0,0,0,0];
foreach $i (0 .. scalar @$arr) { print $i; }