#!/usr/bin/perl
open(FILE,"biao.ini") or die "打开文件失败 \n";
my %hash;
while(<FILE>)
{
next if /^\s*$/;
$_ =~ s/\/\/.*//;
my $arg;
my $value;
my @array = split(/\s+/,$_);
$value = pop(@array); #把最后一个作为值(value)
for (0..$#array)
{
$arg .= $array[$_];
}
$hash{$arg} = $value; #把前面所有的字符串都作为键值(key)
}
foreach (keys %hash)
{
print $_." => ".$hash{$_}."\n";
}
|