--- loncom/homework/caparesponse/caparesponse.pm 2018/09/13 17:00:05 1.259 +++ loncom/homework/caparesponse/caparesponse.pm 2018/09/14 02:51:39 1.260 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # caparesponse definition # -# $Id: caparesponse.pm,v 1.259 2018/09/13 17:00:05 raeburn Exp $ +# $Id: caparesponse.pm,v 1.260 2018/09/14 02:51:39 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -760,7 +760,11 @@ sub end_numericalresponse { my $ans=$answers[$i]; my $fmt=$formats[0]; if (@formats && $#formats) {$fmt=$formats[$i];} - foreach my $element (@$ans) { + my @answers; + if (ref($ans) eq 'ARRAY') { + @answers = (@{$ans}); + } + foreach my $element (@answers) { if ($fmt && $tag eq 'numericalresponse') { $fmt=~s/e/E/g; if ($unit=~/\$/) { $fmt="\$".$fmt; $unit=~s/\$//g; } @@ -770,7 +774,7 @@ sub end_numericalresponse { if ($fmt=~/\$/ && !$needsdollar) { $element=~s/\$//; } } } - push(@fmt_ans,join(',',@$ans)); + push(@fmt_ans,join(',',@answers)); } my $response=\@fmt_ans;