【发布时间】:2012-06-05 03:58:50
【问题描述】:
我有一个包含以下格式数据的文本文件
%app_lookup_strings = (
common => {
password => "password: ",
select_action => "Select action => ",
mgt_close => "BSA_MgtClose",
},
我必须从文本文件中读取这些数据并将其存储回哈希中。我需要知道如何解析具有此类数据的文本文件,并以与上所示类似的哈希方式存储它。
【问题讨论】:
-
使用
Storable;并存储store \%app_lookup_strings, 'file.txt';以取回my $ref = retrieve('file.txt'); -
相关:Store and read hash and array in files,这个问题比这里的这个问题更笼统。
标签: perl hash text-parsing