首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

PERL

2012-06-14 
PERL求助DATE:[group1]aaabbbccc[group2]aaaeeeccc[group3][group4]aaacccperl 的正则 或 其他方法 匹配每

PERL求助
DATE:
[group1]
aaa
bbb
ccc

[group2]
aaa
eee
ccc

[group3]

[group4]
aaa
ccc

perl 的正则 或 其他方法 匹配每组内容,怎么做

[解决办法]

Perl code
#!/usr/bin/env perluse strict;use warnings;while (<DATA>) {    if (/^(\w)(\1+)$/) {        print;    }}__DATA__aaabbbcccabc
[解决办法]
http://search.cpan.org/~schwigon/Config-INI-Serializer-0.001/lib/Config/INI/Serializer.pm
[解决办法]
Perl code
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; 

热点排行