I have a list of regexes that I run on a string to convert it from one style of formatting to another. For now, all of these regexes are stored in a file.
Usually, this works fine. If it reads "Frog" into $from, and "Toad" into $to, then "$string =~ s/$from/$to/" changes all frogs into toads, as desired.
Now I want to do something trickier: given a date "2015-04-15", I want to to change it to "04/2015", again reading from a file. If I load "(\d\d\d\d)-(\d\d)-(\d\d)" into $from and "$2/$1" into $to, this doesn't work: it replaces the dates with the literal string "$2/$1", with actual dollar signs in the output. What's do I need to do?
This is a script for home use only. I am happy to use eval{} or any other strange thing if it will make my life simpler.