> When perl executes a foreach loop, it creates some kind of array of all the > iterators and then goes over them one by one. Is the current index pointer > accessible from inside the loop? I was unable to find anything related in > perlvar.
I think I should clarify myself a little. Here is an example: my @lsit = qw(a b c d); my %indexes; my $current_index = 0; foreach my $element (@list) { $indexes{$element} = $current_index; ++ $current_index; } What I was saying above is that (as far as I understand) perl keeps its own $current_index-like variable to track how far it is into the foreach. Is there a way to use it inside the loop instead of $current_index, thus saving (although negligible) incrementation operation. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>