我有一个哈希数组,我按以下方式填写:
# Array of hashes, for the files, regexps and more.
my @AoH;
push @AoH, { root => "msgFile", file => my $msgFile, filefh => my $msgFilefh, cleanregexp => s/.+Msg:/Msg:/g, storeregexp => '^Msg:' };
Run Code Online (Sandbox Code Playgroud)
这是其中一个条目,我有更多这样的。并且一直使用散列的每个键值对来创建文件、清理文本文件中的行等等。问题是,我通过以下方式创建了文件:
# Creating folder for containing module files.
my $modulesdir = "$dir/temp";
# Creating and opening files by module.
for my $i ( 0 .. $#AoH )
{
# Generating the name of the file, and storing it in hash.
$AoH[$i]{file} = "$modulesdir/$AoH[$i]{root}.csv";
# Creating and …Run Code Online (Sandbox Code Playgroud)