文件数据块的格式与以下文件相同
edit_file content{
val0 data0
val0 data0
val0 data0
val0 data0
val0 data0
}
我的代码是
my $temp_hash;
open FD, "<temp.cfg";
@array = <FD>;
foreach $line (@array) {
if ($line =~ /\s+(.*?)\s+(.*)/) {
foreach $key (keys %tem) {
$temp_hash{$1} = $2;
}
}
print $temp_hash;
}
foreach $array (keys $1) {
print "$key is $temp_hash{$key}\n";
}