in reply to Re^2: Can't get \n or other character/translation escapes to interpolate if originally read from a data file
in thread Can't get \n or other character/translation escapes to interpolate if originally read from a data file

A further elaboration is to use  \s+ in place of a literal space in your pattern strings (in either an array of strings or in __DATA__ records). So
    'Reach Holly Smith for help ...'
might look like
    'Reach \s+ Holly \s+ Smith \s+ for \s+ help \s+ ...'
Because the \s whitespace class includes \n, this has the advantage that a newline or any other combination of whitespace may appear anywhere in the target string and will be matched and replaced. E.g., the target string may be broken over any number of lines in the target text. Important Note: The s///x substitution must use the /x modifier to allow \s+ sub-patterns surrounded by spaces (for readability) to be sprinkled all over the place.


Give a man a fish:  <%-{-{-{-<

  • Comment on Re^3: Can't get \n or other character/translation escapes to interpolate if originally read from a data file
  • Select or Download Code