foreach( keys %totals ) { $totals{$_}= "20" . join "-",( split m#/#, delete $totals{$_} )[2,0,1]; }