$s ='25 {fred and barney} text 2.36 12.0 {bam bam} text {pebbles}'; $n=0; $s =~ s_\{.*?\}_{$sub[$n++]}_g; print $s; 25 {men} text 2.36 12.0 {boy} text {girl}