DATE:
[group1]
aaa
bbb
ccc
[group2]
aaa
eee
ccc
[group3]
[group4]
aaa
ccc
perl 的正则 或 其他方法 匹配每组内容,怎么做
#!/usr/bin/env perl
use strict;
use warnings;
while (<DATA>) {
if (/^(\w)(\1+)$/) {
print;
}
}
__DATA__
aaa
bbb
ccc
abc
use Config::Std;
# Load named config file into specified hash...
read_config 'demo2.cfg' => my %config;
# Extract the value of a key/value pair from a specified section...
$config_value = $config{Section_label}{key};
# Change (or create) the value of a key/value pair...
$config{Other_section_label}{other_key} = $new_val;
# Update the config file from which this hash was loaded...
write_config %config;
# Write the config information to another file as well...
write_config %config, $other_file_name;