$s ='25 {fred and barney} text 2.36 12.0 {bam bam} text {pebbles}'; $n=0; $s =~ s'{.*?}'{$sub[$n++]}'g; print $s; 25 {$sub[$n++]} text 2.36 12.0 {$sub[$n++]} text {$sub[$n++]}