Hi! Yet another hash question:
How can I permanently modify a hash key? I have the following hash: my %hash = ( hygiene_products_total_amount => { 'conditioner' => "5", 'shampoo' => "57", 'soap' => "1", }, cleaning_products_total_amount => { 'mops' => "20", }, ); I tried the following which prints out the correct value, but doesn't permanently modify the key. #removing all but two underscores foreach (keys %hash) { $count = $_ =~ s/(_)/$1/gi; while (($count = $_ =~ s/(_)/$1/gi) > 2) { $_ =~ s/_//; } print "\n$_\n"; } Any help is appreciated. Thanks! /Mark