develooper Front page | perl.perl5.porters | Postings from June 2021

Re: RFC: Multiple-alias syntax for for

Thread Previous | Thread Next
Marco Fontani
June 10, 2021 08:20
Re: RFC: Multiple-alias syntax for for
Message ID:
>     for my ($key, $value) (%hash) { ... }


    for my ($index, $value) (@array) { ... }

... be in the cards?

I always find it tiring to have to iterate by index using a weird:

    for my $i (0..$#array) {
        my $value = $array[$i];
        # ...

... and I'd rather the golang way (unsure if other languages have it)
of being able to iterate either by value, or key/value for
maps/hashes, or index/value for arrays, specifically.

Marco Fontani
perl -E'say v74.65.80.72'

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About