E
Erik 2.0
dear perl people,
in the spirit of both perl's brevity and it's "do what i mean" array
contexts, it would be an appropriate feature for foreach loops to
support an array of variables as the iterator as well as just a
scalar. this would cause perl to alternate across the array:
for example:
foreach ($key, $val) in (@pairs) {
print "$key=$val\n";
}
an odd number of values in @pairs would cause an extra iteration with
$val set to undef
this syntax for an "alternating foreach" seems quite elegant to me.
it would reduce the number of keystrokes i type by dozens per week.
counting this email, and assuming the feature gets implemented, i'd be
net positive within 8 months or so.
- love
erik
in the spirit of both perl's brevity and it's "do what i mean" array
contexts, it would be an appropriate feature for foreach loops to
support an array of variables as the iterator as well as just a
scalar. this would cause perl to alternate across the array:
for example:
foreach ($key, $val) in (@pairs) {
print "$key=$val\n";
}
an odd number of values in @pairs would cause an extra iteration with
$val set to undef
this syntax for an "alternating foreach" seems quite elegant to me.
it would reduce the number of keystrokes i type by dozens per week.
counting this email, and assuming the feature gets implemented, i'd be
net positive within 8 months or so.
- love
erik