I need to copy a (one-level) hash to a new one, with all values lowercased.
Do you know a smart method (just to avoid an ugly foreach... ;-)
my %new = map { $_ => lc $old{$_} } keys %old;
This is a one liner using map
:
my %newHash = map { $_ => lc $existingHash{$_} } keys %existingHash;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With