On Sat, Aug 19, 2000 at 09:23:03AM -0400, Ken Fox wrote:
> "Christopher J. Madsen" wrote:
> > foreach $item $index (@array) {
> > print $item, " is at index ", $index, "\n";
> > }
>
> That's useful syntax, but I'd rather it mean stepping
> pair-wise through @array. Then we could scan through a hash
> with
>
> foreach $key $value (%hash) { ... }
Yes. I thought someone else would have done an RFC for this by
now, but I was going to propose that a for loop can
have any number of variables
for my($a,$b,$c) (@array) { ... }
steps three at a time,
for my($key,$val) = (%hash) { ... }
Then there is also
for my($a,$b,$c) (zip(@a,@b,@c)) { ... }
steps through each array at the same time
Graham.
- Re: RFC 120 (v2) Implicit counter in fo... Jonathan Scott Duff
- Re: RFC 120 (v2) Implicit counter i... Christopher J. Madsen
- Re: RFC 120 (v2) Implicit coun... Jonathan Scott Duff
- Re: RFC 120 (v2) Implicit ... Christopher J. Madsen
- Re: RFC 120 (v2) Implicit coun... Ariel Scolnicov
- Re: RFC 120 (v2) Implicit ... Mike Pastore
- Re: RFC 120 (v2) Implicit ... David L. Nicol
- Re: RFC 120 (v2) Implicit ... Johan Vromans
- Re: RFC 120 (v2) Implicit ... Buddha Buck
- Re: RFC 120 (v2) Implicit counter in for statem... Ken Fox
- Re: RFC 120 (v2) Implicit counter in for st... Graham Barr
- Re: RFC 120 (v2) Implicit counter in fo... Peter Scott
- Re: RFC 120 (v2) Implicit counter in for statements,... Nathan Torkington
- Re: RFC 120 (v2) Implicit counter in for statements,... Steve Simmons
- Re: RFC 120 (v2) Implicit counter in for statem... John McNamara
- Re: RFC 120 (v2) Implicit counter in for st... Jonathan Scott Duff
- Re: RFC 120 (v2) Implicit counter in fo... John McNamara
- Re: RFC 120 (v2) Implicit counter in for st... Steve Simmons
- Re: RFC 120 (v2) Implicit counter in for st... David L. Nicol
- Re: RFC 120 (v2) Implicit counter in fo... Jonathan Scott Duff
- Re: RFC 120 (v2) Implicit counter i... Tom Christiansen
