TomSW has asked for the wisdom of the Perl Monks concerning the following question:

I'm new to Perl but really appreciate its ergonomics. Even $_ was a bit of a revelation...
Would it be useful to have another such variable that counted through the iterations of a list expression, like a foreach, an each, or a map?
Naturally, it wouldn't really be a subscript for hashes, but I'm sure it could be quite handy even you can usually make one with a one-liner (my $strokeofgenius++).
Or maybe a super-list context that enumerated a list of lists simultaneously and gave you a cross-section of them on each pass
But I suppose, again, this wouldn't make much sense with hashes, and if you're not thinking hashes you're not thinking Perl.
ho hum, back to work

Replies are listed 'Best First'.
(tye)Re: an auto-subscript?
by tye (Sage) on Jan 10, 2002 at 21:20 UTC

    Yes, a way to get the "iteration count" is often asked for. As you mention, many of the cases where you want that really boil down to wanting to iterate multiple lists at once. You can use mapcar -- map for more than one list for such cases.

            - tye (but my friends call me "Tye")