in reply to Re: String to Integer, for json file
in thread String to Integer, for json file

Thank you davido for the explanation, it has truly enlightened me.

Replies are listed 'Best First'.
Re^3: String to Integer, for json file
by Anonymous Monk on Dec 12, 2013 at 09:45 UTC
    A string can become a number again :) Its the flags that reveal the true nature (last touch)
    use JSON qw/ to_json from_json /;
    use Devel::Peek qw/ Dump /;
    my $q = 3;
    print "$q\n";
    Dump( $q );
    $q++;
    Dump( $q );
    print to_json( { a => 3, qw/ b 3 q/, $q } );
    __END__
    3
    SV = PVIV(0x9a3778) at 0x99b524
      REFCNT = 1
      FLAGS = (PADMY,IOK,POK,pIOK,pPOK)
      IV = 3
      PV = 0xad23fc "3"\0
      CUR = 1
      LEN = 12
    SV = PVIV(0x9a3778) at 0x99b524
      REFCNT = 1
      FLAGS = (PADMY,IOK,pIOK)
      IV = 4
      PV = 0xad23fc "3"\0
      CUR = 1
      LEN = 12
    {"a":3,"q":4,"b":"3"}
    http://search.cpan.org/dist/illguts/index.html