Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!ruuinf!henkp From: henkp@ruuinf.cs.ruu.nl (Henk P. Penning) Newsgroups: comp.lang.perl Subject: Re: Proposed extension Keywords: arrays perl Message-ID: <4561@ruuinf.cs.ruu.nl> Date: 21 Dec 90 13:42:15 GMT References: <29428@shamash.cdc.com> Organization: Utrecht University, Dept. of CS Lines: 35 In article <29428@shamash.cdc.com> rrr@u02.svl.cdc.com (Rich Ragan) writes: >I keep needing to get at the current index of the iterator. >Access to the current iterator index would seem to be useful for other >common things such as "the previous element" or "the next element" that >I have seen asked about in this group. > [ examples and proposal for getting the index of the current iterator ] >Any thoughts on these ideas. I suspect that strengthening the array >features of perl will improve its power and speed (fewer things to >interpret per unit of work done) I agree; one of Perl's strongest points could be made stronger. I think it would be very usefull if some for-construct could take a list of iterators and arrays in stead of just one. Something like: forall $elem1, $elem2, $elem3 ( @row1 ; @row2 ; @row3 ) { zip info in row1, row2, row3 } Then you could say: forall $elem, $i ( @row ; 0..$#row ) { ... } Or: forall $a, $b ( @a ; @b ) { $a += $b ; } === HenkP === -- Henk P. Penning, Dept of Computer Science, Utrecht University. Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands. Telephone: +31-30-534106 e-mail : henkp@cs.ruu.nl (uucp to hp4nl!ruuinf!henkp)