http://qs321.pair.com?node_id=11127607


in reply to can I change hash keys or values directly

There's no array of keys or values. There's a list of keys and list of values, and the list of values in fact contains the values themselves, so you can modify them, e.g.
#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; my %hash = (key1 => 'val1', key2 => 'val2'); s/val/V/ for values %hash; say "$_ => $hash{$_}" for keys %hash;

You can't modify the keys in this way, though (and both the facts are documented in keys and values. That's because you can't change a key in a hash, you need to remove the old one and create a new one, because the after a key change, the value is most probably going to be stored in a different place.

Using a slice is probably the best you can do.

my @old = keys %hash; @hash{map uc, @old} = delete @hash{@old};
Be sure to keep the keys unique after the modification!

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