|go ahead... be a heretic|
can I change hash keys or values directlyby misterperl (Monk)
|on Jan 28, 2021 at 21:06 UTC||Need Help??|
misterperl has asked for the wisdom of the Perl Monks concerning the following question:
Hello kind monks. I have a case where a some of my hash keys need adjusting. I thought perhaps:
.. would be a nice approach but no joy. I guess that "keys %h" is an anonymous array copy of the keys; not the actual keys, because the were unchanged. I never realized that.
Of course I can do this in a loop, and I even managed to do it with a slice followed by a delete. So I'm not asking HOW to accomplish the task - as Larry told me (over and over as I recall) at the OSCONs- there are MANY ways... You know the rest :)
I guess what I'm really asking is, is there a perlVar or function that is the TRUE array of hash key and one of values that,when changed, changes the keys or values?
I guess I see a dilemma with this - since adjusting keys may make the array of keys shorter, and it may not be determinant on how to adjust the values. So this might not even be practical. Although being able to map VALUES does seem appealing and practical. I'm interested in what you expert Monks think?
TY & Blessed Be