0
我想在我的Perl代碼中使用Config :: scoped模塊。perl config :: scoped,是否可以打印未定義的值?
這是我的配置:
http_db{
user = 'xxx';
pass = 'aaa';
dbname = 'data';
host = 'dataserver.company.cz';
}
當我使用:
my $cs = Config::Scoped->new(file => $config);
my $cfg_hash = $cs->parse;
.
.
.
print $cfg_hash->{http_db}{user}; # prints xxx;
if (defined($cfg_hash->{http_dp}{user})) {
print "defined"; # does not print
else{
print "undefined"; # prints
}
我預計如果條件被fullfilled,但事實並非如此。爲什麼?