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

Re: RFC: Multiple-alias syntax for for

Thread Previous | Thread Next
From:
Marco Fontani
Date:
June 10, 2021 08:20
Subject:
Re: RFC: Multiple-alias syntax for for
Message ID:
CANNjYqUB58EJV52-QHuu3kxk_MUO_v1TKXCZmGfnbCO8E9DN6g@mail.gmail.com
>     for my ($key, $value) (%hash) { ... }

Could:

    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
+39-329-2180550
perl -E'say v74.65.80.72'

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About