in reply to Array Element Substitution
Hello Mac1, and welcome to the Monastery!
For the task outlined, I would build a hash with names-to-be-replaced as the keys, and their replacements as the values.
However, I think you should first clarify the format of your input files. Do you intend that each occurrence of “Jupiter” be replaced with “Host1”, each occurrence of “Mars” be replaced with “Host2”, etc.? If so, this scheme looks very brittle. For example, a single name out of place in either file would throw out the replacements for all words following.
Also, did you intend Jupiter Mars Earth to follow one another on the same line (as shown), or to appear on separate lines? This makes a difference to the way the input files are read in and parsed.
Please specify the precise formats of the two input files, and their relationship to each other. This will make it easier for the monks to help you (and may help to clarify your own thinking about the problem).
Athanasius <°(((>< contra mundum
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Array Element Substitution
by Mac1 (Initiate) on Aug 23, 2012 at 17:56 UTC |