Mike Pastore <[EMAIL PROTECTED]> writes:
> I like the proposed syntax! I also think that C<keys @array> would be
> useful, ...
Seconded. It nicely fits in the current way each() is used and no
backward incompatibilties.
Especially when iterating sparse arrays.
while (($index,$value) = each(@sparse_array)) {
print "sparse_array[$index] = $value\n";
}
would be much more efficient as
$index = -1;
foreach (@sparse_array) {
$index++;
next unless exists $_;
print "sparse_array[$index] = $_\n";
}
I also second the use or keys() and values() for arrays. It fits
so nicely. Plus the added benefits if the array is sparse.
-- Johan
- Re: RFC 120 (v2) Implicit counter in for statem... Glenn Linderman
- Re: RFC 120 (v2) Implicit counter in for statem... David L. Nicol
- Re: RFC 120 (v2) Implicit counter in for st... Christopher J. Madsen
- 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
