in reply to A Solution to the edit Word documents with Perl problem

Hi perlmonk, I am working on translating input for a book from Spanish to English. Sounds easy, but the problem is that this is a specialized book containing plant descriptions in technical botanical terms. So normal translators like imbedded in WORD, Google, etc do not work well. They generate so many errors in the technical descriptions of the plants they are not worth using. I know the translations for words and phrases, but I'd like to automate them to make my job easier. So, I wrote some perl code to search for the words and phrases and replace those with my translations. Problem is that normal read/write in perl does not result in a readable MS WORD (.doc) file as output; even if it is labeled as .doc. I can copy the text to a .txt file, then run my translator on it, but I lose all the formatting in WORD. So, I came across your subroutine in this post (thank you very much), but I'm not expert enough in perl to understand if it will do what I want. I want to do simple text substitution while preserving the WORD formatting in the .doc file. Is that what this subroutine does? If so, where do I put the words and phrases I am searching for and their corresponding translations? Here is some code from my perl program to show the types of substitutions I'm trying to do: # Specific word & phrase translations s/en floración alcanza/flowering/g; # change ONLY FIRST instance of de largo to tall, remainder get changed to long s/de largo/tall/; s/de largo/long/g; # remaining word translations go here s/de ancho/wide/g; s/numeroso/numerous/g; s/denso|densa/dense/g; s/roseta/rosette/g; s/extendida/extended/g; s/ápice/apex/g; I would appreciate any assistance you can provide me. Many thanks, Jerry
  • Comment on Re: A Solution to the edit Word documents with Perl problem