|Just another Perl shrine|
Efficient selective substitution on list of wordsby Polyglot (Monk)
|on Jan 31, 2010 at 02:48 UTC||Need Help??|
Polyglot has asked for the
wisdom of the Perl Monks concerning the following question:
Greetings to all,
I asked in the chat window several days ago about how to accomplish this, and tye provided me a good answer using map and sort. Unfortunately, my laptop crashed shortly thereafter, and I lost his answer. (That'll teach me, ha!) However, there are a couple of complicating factors that tye may not have addressed even then, and I'm looking for wisdom on a succinct and safe way of accomplishing this.
Here's what I have:
So, what I need to do is substitute each word in the first column for the word(s) in the second column, except where the word in the stopwords column is matched. While this seems like a simple scenario, I'm struggling to wrap my brain around it. I'm just beginning to grasp the concepts of map and join, and their syntax, but would much appreciate some ideas for how to accomplish this.