我无法弄清楚这段代码中的语法错误是什么:
my $questions{$question} = $answer
我正在尝试将每个问题/答案对分配给哈希,但我不知道语法错误是什么。
#!/usr/bin/perl
use warnings;
use CGI;
my $cgi = CGI->new;
my $text = $cgi->param('splash');
my $anslist = "/home/megaoff/www/limages/anslist.txt";
my $unanslist = "/home/megaoff/www/limages/unansquestions.txt";
open(my $ANS, '<', $anslist) or die "Can't open file: $anslist";
open(my $UNANS, '>>', $unanslist) or die "Can't open file: $unanslist";
while(my $line = <$ANS>) {
my($question, $answer) = split(/\t/, $line);
my $questions{$question} = $answer;
}
close($ANS) or die "Couldn't close file: $anslist";
close($UNANS) or die "Couldn't close file: $unanslist";