Jan 24, 2012, 9:23 AM
Post #2 of 3
Replacement itself is easiest by substitution via regular expression. For example, if $s equals 'abc_3 X Y Z', the statement
Re: [jtra00] I Need to replace names from 1 file everytime they occur in another file
[In reply to]
changes $s into 'abc_dogfood X Y Z'.
To extract the values you need, from file A, you read it line by line, and use the split function.
The canonical way to store the association between the numbers (2) and keywords (rat) would be to use a hash. Since in your case, the numbers are continuous integers, you could also use an array, depending on what you feel more comfortable with.