in reply to how to substitute a word in a file by perl

And what exactly are you having problems with? Read the file line by line, do a global substitution of wood versus food, write into a temp file. Delete input and rename temp file to original name.