#!/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}