in reply to Re: can I change hash keys or values directly
in thread can I change hash keys or values directly

I appreciate the replies guys. I guess I was already on the best approach using the slice. The link to "values" and it's helpful to know that they be operated on directly. I tried it
map s.(\d+).$1+1/e,values %nums;
which worked great. Love it. Helpful & useful. TYVM

If I'm reading that right, it does appear from that link that as an experiment, perhaps keys also worked that way for some brief Perl versions:

use 5.012; # so keys/values/each work on arrays

Replies are listed 'Best First'.
Re^3: can I change hash keys or values directly
by choroba (Cardinal) on Jan 29, 2021 at 22:44 UTC
    > perhaps keys also worked that way

    No, it means you can write

    #!/usr/bin/perl use warnings; use strict; use feature qw{ say }; use Syntax::Construct qw{ keys-array }; # More explicit than 5.012. my @array = qw( abc def ); my @keys = keys @array; # 0, 1 my @values = values @array; # abc, def while (my ($index, $value) = each @array) { say "$index $value"; # 0 abc, 1 def }

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]