mktables creates data structures on files that are later read in. Some
of these are nominally floating point numbers, like 2.0. But they are
actually version numbers, and if output without being quoted, they will
be read in as just an integer and a string compare will fail. Actual
floating point numbers are also output, but if these are output enclosed
in quotes, they will be coerced into the correct data type when
necessary.
This fix doesn't correct any known existing problems, but is needed for
future commits.
my $copy = $item;
$copy = $UNDEF unless defined $copy;
- # Quote non-numbers (numbers also have optional leading '-' and
- # fractions)
- if ($copy eq "" || $copy !~ /^ -? \d+ ( \. \d+ )? $/x) {
+ # Quote non-integers (integers also have optional leading '-')
+ if ($copy eq "" || $copy !~ /^ -? \d+ $/x) {
# Escape apostrophe and backslash
$copy =~ s/ ( ['\\] ) /\\$1/xg;