Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A foreach iterator for hashes / tuples / pairs #40

Closed
schwern opened this issue Jun 19, 2009 · 2 comments
Closed

A foreach iterator for hashes / tuples / pairs #40

schwern opened this issue Jun 19, 2009 · 2 comments

Comments

@schwern
Copy link
Contributor

schwern commented Jun 19, 2009

Instead of

for my $key (keys %hash) {
    my $value = $hash{$key};
    ....
}

I want
for my($key, $value) (%hash) {
...
}

Or something. Also working for pairs in lists. Extend it out to work for any number of elements.

@exodist
Copy link
Contributor

exodist commented May 12, 2010

done in Block-NamedVar

@schwern
Copy link
Contributor Author

schwern commented Jul 12, 2010

Its in 2.3.0_01.

I suspect this will be better served in v3 by a method and subroutine signatures with signature introspection.

@array->for( def($first, $second, $third) {
     ...
});

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants