在Perl中读取点符号(。) [英] Reading a dot symbol (.) in perl
本文介绍了在Perl中读取点符号(。)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个.conf文件,看起来像这样:
I have a .conf file which looks like this:
[offline_online_status]
offline_online_status.offline_online_state=ONLINE
perl如何读取上面值中的点符号(。)?有人可以教我吗?
How can perl read the dot symbol (.) in the value above? Can anybody teach me?
推荐答案
尝试使用此方法,进行自己的修改:
Try to use this, make your own modification:
use CGI;
use Config::Tiny;
use Data::Dumper;
use CGI::Carp qw(fatalsToBrowser);
#location/directory of configuration file
my $file = "your configuration file path";
my $Config = Config::Tiny->read($file);
#reads the section, key and the value of the configuration file.
my $status_in_file = $Config->{"offline_online_status"}->{"offline_online_status.offline_online_state"};
之后,只需打印$ status_in_file。该代码将读取配置文件中的整个键和值。
And after that just print the $status_in_file. This code will read the entire key and value in your configuration file.
这篇关于在Perl中读取点符号(。)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文