いくつかの既存のコードを変更して、いくつかの追加機能を追加するように求められました。私はGoogleで検索し、答えを見つけることができないようです。私は、私は次のエラーを取得しています。この効果に何か...Perlでサブルーチンの引数としてハッシュを使用するにはどうすればよいですか?
%first_hash = gen_first_hash();
%second_hash = gen_second_hash();
do_stuff_with_hashes(%first_hash, %second_hash);
sub do_stuff_with_hashes
{
my %first_hash = shift;
my %second_hash = shift;
# do stuff with the hashes
}
を持っている:
Odd number of elements in hash assignment at ./gen.pl line 85.
Odd number of elements in hash assignment at ./gen.pl line 86.
Use of uninitialized value in concatenation (.) or string at ./gen.pl line 124.
Use of uninitialized value in concatenation (.) or string at ./gen.pl line 143.
ライン85と86は、サブ・ルーチンの最初の2行で、どこI 124と143は、ハッシュにアクセスしています。これらのエラーを調べると、私のハッシュが初期化されていないことが示唆されているようです。ただし、ハッシュに値があることを確認できます。なぜこれらのエラーが表示されますか?
これは複製です。 http://stackoverflow.com/questions/944784/を見てください – innaM