in reply to
searching for number & string....
Welcome to the Monastery! Make yourself at home.. Post the questions in Seekers of Perl Wisdom.
You have to go through open, perlsyn, perlop and perlre to accomplish your job.
#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 document
#write the result - refer Perl Syntax documentation