Subject: | Keys that start with a number cause warning: Invalid characters in key |
The documentation says:
Show quoted text
> There are a couple of restrictions as for the names of the keys. First of all, all the characters
> should be alphabetic, numeric, underscores or hyphens, with square brackets allowed for the
> clustering. That is, the keys should conform to /^[A-Za-z0-9_-]+$/
But keys cannot start with a number, because Config::File uses eval and:
Show quoted text> perl -le 'my %foo; $foo[344foo]=23'
Bareword found where operator expected at -e line 1, near "344foo"
So the regex in the documentation is incorrect.
To reproduce:
Show quoted text> cat ost.txt
config[foo] = 23
config['123foo'] = 23
Show quoted text> perl -MData::Dumper -MConfig::File -e 'print Dumper(Config::File::read_config_file("ost.txt"))'
Invalid characters in key config['123foo'] at line 2 - Ignoring at /usr/share/perl5/Config/File.pm line 41, <GEN0> line 2.
$VAR1 = {
'config' => {
'foo' => '23'
}
};