karls-mac-mini:monks karl$ perl -MData::Dumper -e '$hash{'cl_ip'} = "29988" + 0;print Dumper(\%hash);'$VAR1 = { 'cl_ip' => 29988 }; #### #!/usr/bin/env perl use JSON::XS; use Data::Dumper; my %hash = ( cl_ip => 209890 ); my $json = encode_json \%hash; print Dumper( \%hash ); print qq($json\n); $hash{ cl_ip } += 0; $json = encode_json \%hash; print Dumper( \%hash ); print qq($json\n); __END__ karl-mac-mini:monks karl$ ./json.pl $VAR1 = { 'cl_ip' => 209890 }; {"cl_ip":209890} $VAR1 = { 'cl_ip' => 209890 }; {"cl_ip":209890} #### #!/usr/bin/env perl use JSON::XS; use Data::Dumper; my %hash = ( cl_ip => 209890 ); my $json = encode_json \%hash; print Dumper( \%hash ); print qq($json\n); $hash{ cl_ip } += 0; $json = encode_json \%hash; print Dumper( \%hash ); print qq($json\n); $hash{ cl_ip } = "209890"; $json = encode_json \%hash; print Dumper( \%hash ); print qq($json\n); __END__ $VAR1 = { 'cl_ip' => 209890 }; {"cl_ip":209890} $VAR1 = { 'cl_ip' => 209890 }; {"cl_ip":209890} $VAR1 = { 'cl_ip' => '209890' }; {"cl_ip":"209890"} #### #!/usr/bin/env perl use JSON::XS; use Data::Dumper; use strict; use warnings; my %hash = ( cl_ip => 209890 ); print Dumper( \%hash ); print qq(\n); my $json = encode_json \%hash; print qq($json\n\n); #------------------------------ $hash{cl_ip} += 0; print Dumper( \%hash ); print qq(\n); $json = encode_json \%hash; print qq($json\n\n); #------------------------------ $hash{cl_ip} = "209890"; print Dumper( \%hash ); print qq(\n); $hash{cl_ip} += 0; print Dumper( \%hash ); print qq(\n); $json = encode_json \%hash; print qq($json\n\n); __END__ karl-mac-mini:monks karl$ ./json.pl $VAR1 = { 'cl_ip' => 209890 }; {"cl_ip":209890} $VAR1 = { 'cl_ip' => 209890 }; {"cl_ip":209890} $VAR1 = { 'cl_ip' => '209890' }; $VAR1 = { 'cl_ip' => 209890 }; {"cl_ip":209890}