my @sub = qw(men boy girl); $string =~ s/(?<={)[^}]*(?=})/shift @sub/ge;