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

Reply via email to