=pod =for advent_year 2008 =for advent_day 22 =for advent_title Egg substitute nog =for advent_author Jerrad Pierce How often have you mangled a document with B<-i>nline editing like the first block in our code sample? That's what B<-i~> is for of course, but if you forget, the damage is done. Often, it may be possible to work around such difficulties as in blocks two and three, but what if you haven't stemmed or grepped all the text in the document to look for possible substr conflicts? You're in a rush and have no desire to muck with boundaries and look-aheads/behinds… You just just want a nice, simple, DWIMmy, explicit text replacement. M to the rescue. subst is a small parser that accepts multiple pairs of strings or regular expressions to locate, and a string or Bxpr (né C) to replace matches with. The easy to mistype function then manages to perform the substitutions in a sane manner, regardless of order specified. This code lends itself to solving more complex problems, and can even serve as a basic templating engine. =sourcedcode mod22.pl