--- loncom/homework/default_homework.lcpm 2004/06/04 22:56:46 1.85 +++ loncom/homework/default_homework.lcpm 2004/06/09 21:16:43 1.87 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run() # -# $Id: default_homework.lcpm,v 1.85 2004/06/04 22:56:46 albertel Exp $ +# $Id: default_homework.lcpm,v 1.87 2004/06/09 21:16:43 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -344,7 +344,7 @@ sub random_multivariate_normal { my ($item_cnt,$seed,$mean,$covar) = @_; my @oldseed=&random_get_seed(); &random_set_seed_from_phrase($seed); - @retArray=&math_random_multivariate_normal($item_cnt,@$mean,@$covar); + my @retArray=&math_random_multivariate_normal($item_cnt,@$mean,@$covar); &random_set_seed(@oldseed); return @retArray; } @@ -354,7 +354,7 @@ sub random_multinomial { my @oldseed=&random_get_seed(); my @retArray; &random_set_seed_from_phrase($seed); - @retArray=&math_random_multinomial($item_cnt,@p); + my @retArray=&math_random_multinomial($item_cnt,@p); &random_set_seed(@oldseed); return @retArray; } @@ -523,7 +523,7 @@ sub chemparse { $formula .= $molecule.' '; } # get rid of trailing space - $formula =~ s/(\Q${nbsp}\E| )$//; + $formula =~ s/(\ \;| )$//; return &xmlparse($formula); } @@ -535,7 +535,7 @@ sub prettyprint { if ($fmt =~ /chem/i) { return(&chemparse($value)); } my ($dollarmode,$commamode,$alwaysperiod,$options); if ($fmt =~ /^([^\d]*)(.*)/) { $options=$1; $fmt=$2; } - if ($options =~ /\$/) { $dollamode=1; } + if ($options =~ /\$/) { $dollarmode=1; } if ($options =~ /,/) { $commamode=1; } if ($options =~ /\./) { $alwaysperiod=1; } if ($fmt) { $value=sprintf('%.'.$fmt,$value); } @@ -568,8 +568,8 @@ sub prettyprint { } } else { $result=$value; - if ($dollarmode) { $result=&dollarformat($result,$target); } - if ($commamode) { $result=&commaformat($result,$target); } + if ($dollarmode) { $result=&dollarformat($result,$target); } + elsif ($commamode) { $result=&commaformat($result,$target); } } return $result; }