Its solves my issue but fails in the scenario when i have module this is in between OLD(A, B, Y);, i even want my script to change it to, module this is in between NEW(A, B, Y); hence i tried doing this (?<=module .*)$ARGV[2].*?([\\(;])"; which doesnt work and shell says <bold>Variable length lookbehind not implemented in regex; marked by <-- HERE in m/(?<=module .*)NEW.*?(\(;) <-- HERE / at script.pl line 23.</bold>. How can i implement this?