I would like to load a string with newlines from a configuration file. The script I am modifying uses the Config::Simple module.
Here's a MWE:
# file: script.pl
use strict;
use warnings;
use Config::Simple;
# read config file
my $cfg = new Config::Simple('config.cfg');
my %config = $cfg->vars();
# read parameter 'string'
my $var = $config{"string"};
print($var);
This works fine for 'normal' strings in config.cfg:
# file: config.cfg
string: "One Two Three"
Now I want to store a string with newlines in the parameter string. Since Config::Simple requires each parameter to be on a single line (i.e. does not support multi-line parameters), I tried the following
# file: config.cfg
string: "One \nTwo \nThree"
but it seems that Config::Simple strips the \ character, because $var becomes
One nTwo nThree
Is there a good way to do this with Config::Simple?