In perl5, it's not always possible to distinguish between a number and a string.
The following table shows some examples, the internal flags of the variable, and how several JSON and YAML modules treat them.

INT NUMBER STRING JSON::PP JSON::XS Cpanel::JSON::XS JSON::Tiny Mojo::JSON YAML YAML::XS YAML::Syck YAML::PP YAML::Tiny
2.97001 3.04 4.02 0.58 7.75 1.26 0.72 1.30 0.007 1.73
1 $x = 10 x 10 10 10 10 10 10 10 10 10 10
2 $x = 11; $x .= ""; $x x "11" "11" "11" "11" "11" 11 '11' 11 '11' '11'
3 $x = 12; $x .= "x"; $x += 0; $x x 12 12 12.0 12 12 12 12 '12' 12.0 12
4 $x = 13; $y = $x . "string"; $x x x 13 "13" 13 13 13 13 13 13 13 '13'
5 $x = 14; $x .= ""; $x += 0; $x x 14 14 14 14 14 14 14 14 14 14
6 $x = 15; $x .= ""; $y = $x + 1; $x x x 15 "15" 15 15 15 15 15 15 15 '15'
7 $x = "16" x "16" "16" "16" "16" "16" 16 '16' 16 '16' '16'
8 $x = "17"; $x += 0; $x x 17 17 17 17 17 17 17 17 17 17
9 $x = "18"; $y = $x + 0; $x x x 18 "18" 18 18 18 18 18 18 18 '18'
10 $x = 19; $x .= "x"; $y = $x + 0; $x x x x "19x" "19x" "19x" "19x" "19x" 19x 19x 19x 19x 19x
11 $x = 2e1 x 20 20 20.0 20 20 20 20 '20' 20.0 20
12 $x = "021"; $y = $x + 0; $x x x "021" "021" "021" "021" "021" 021 021 '021' '021' '021'
13 $x = 22.1; $x x 22.1 22.1 22.1 22.1 22.1 22.1 22.1 '22.1' 22.1 22.1
14 $x = 23.1; $y = $x . ''; $x x 23.1 23.1 23.1 23.1 23.1 23.1 23.1 '23.1' 23.1 23.1
15 $x = 24.1; $x .= ''; $x x "24.1" "24.1" "24.1" "24.1" "24.1" 24.1 '24.1' '24.1' '24.1' '24.1'
16 $x = "25.0"; $y = $x + 0; $x x x x "25.0" "25.0" "25.0" "25.0" "25.0" 25.0 25.0 '25.0' '25.0' '25.0'
17 $x = 0 + "inf" x Inf inf null "Inf" "Inf" Inf Inf 'Inf' .inf Inf
18 $x = 0 - "inf" x -Inf -inf null "-Inf" "-Inf" -Inf -Inf '-Inf' -.inf -Inf
19 $x = 0 + "nan" x NaN -nan null "NaN" "NaN" NaN NaN 'NaN' .nan NaN

Generated with perl v5.24.1.
Source on Github