while (<>) { $line = $_; $line =~ s/func1\((.*?)\)/proc1{$1}/g; $line =~ s/func2\((.*?)\)/FUNC $1 END/g; $line =~ s/{/(/g; $line =~ s/}/)/g; print $line; }