私はファイルのいくつかの情報を持つデータベースを作成しています。
例:file_name |サイズ| ... MODIFY_DATE
私はこのような状況では、より効率的であるものを考えていた:情報を取得し、私のファイルPerlのファイルへの書き込み効率
foreach my $file (@listOfFiles) {
my %temporary_hash = get_info_for_file($file); //store in a tempoarary hash
the informations for current file
print_info(%temporary_hash, $output_file); // print the information in my output file
}
2)ストアでそれらを印刷
1)ファイルごとにハッシュ内のすべてのファイルに関する情報を一度にすべて出力します。
foreach my $file(@listOfFiles){
store_info_in_hash(get_info_for_file($file), %hash); // for each file, store the
information in a global hash
}
print_all_info(%hash, $output_file); //after i have informations for each file
print the whole hash in my output file
あなたのプログラムは、4つの機能を持っており、私は彼らが何をすべきか見当がつかない。それらについて少し説明することができれば、私たちはあなたの質問を正しく理解するのに役立つかもしれません。 – Arijit
なぜ効率性に関心がありますか? @listOfFiles;のprint_info(get_info_for_file($ _)、$ output_file)を書くと思います。これは最初のオプションと同じです。しかし、camelCaseとsnake_caseを混ぜて使用しないでください。 – Borodin
私は関数名を示唆していると思っていましたが、私はいくつかのコメントを追加しました – user30771