my $tmp = 'Fritz'; my %test = ( (foo => $tmp) =~ s/F/Kr/, ); say $test{foo}; # print's "Kritz"