读书人

PERL

发布时间: 2012-06-14 16:00:31 作者: rapoo

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; 

读书人网 >perl python

热点推荐