I have a file with the following syntax in some_1.xyz
module some_1 { INPUT PINS OUTPUT PINS }
and I want to insert APPLY DELAYS xx and APPLY L
$text='bla bla mytext bla bla'; $find='.*mytext.*'; $repl='replacement'; $text=~ s/($find)/$1$repl/g;
$1 is basically your match and you can use it when you make the replacement, either before or after your $repl string. )))
EASY