--- loncom/interface/lonprintout.pm 2005/08/16 10:25:15 1.386 +++ loncom/interface/lonprintout.pm 2005/08/22 09:48:25 1.387 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.386 2005/08/16 10:25:15 foxr Exp $ +# $Id: lonprintout.pm,v 1.387 2005/08/22 09:48:25 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -87,11 +87,11 @@ sub letters_to_num { sub is_valid_numeric_code { my ($value, $num_digits) = @_; # Remove leading/trailing whitespace; - $value =~ s/^\s*//; - $value =~ s/\s*$//; + $value =~ s/^\s*//g; + $value =~ s/\s*$//g; # All digits? - if ($value =~ /^[0-9]+$/) { + if ($value !~ /^[0-9]+$/) { return "Numeric code $value has invalid characters - must only be digits"; } if (length($value) != $num_digits) { @@ -1386,12 +1386,12 @@ ENDPART $num_todo=scalar(@allcodes); } elsif ($single_code) { + $num_todo = 1; # Unconditionally one code to do. # If an alpha code have to convert to numbers so it can be # converted back to letters again :-) # if ($code_type ne 'number') { $single_code = &letters_to_num($single_code); - $num_todo = 1; } @allcodes = ($single_code); } else {