#open the file in read mode - refer open documentation #search the PID and string using regex -refer regex documentation #check the condition - refer Perl operator documentation #open the file in write mode to save in new file - refer open documentation #write the result - refer Perl Syntax documentation