Am Samstag, 21. Mai 2005 04.21 schrieb Peter Rabbitson: > Hello, > > 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. > > Thanks for the input > > Peter > > P.S. I know it is trivial to add an incrementing counter at the end of > the loop, but it seems redundant to me, since perl got to do something > similar anyway just to keep track of its own state.
I can't see the _necessity_ of holding an "overall index" while iterating over a list. At lest theoretically, the iteration could be implemented with a linked list; and if you have something like for (@array, keys (%hash), 'a', 'b', ret_array()) {...} why keep track of, for example, the index of 'b' within the _whole_ list? (but I can't answer your question :-) joe -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>