in reply to add a line or string in complex perl file

i want to add $execdir before txt52_mm.cfg...

No you don't. Because tomorrow to want to change txt52 in catch42. Replace the entire directory/filename with a variable, so you gain more flexibility. Hard-coding names is seldom a good idea.

Paul

PS. Please use <code>-tags in the future...