Search Results

Search found 1 results on 1 pages for 'yobert'.

Page 1/1 | 1 

  • Is there a way to test if a scalar has been stringified or not?

    - by Yobert
    I am writing a thing to output something similar to JSON, from a perl structure. I want the quoting to behave like this: "string" outputs "string" "05" outputs "05" "5" outputs "5" 5 outputs 5 05 outputs 5, or 05 would be acceptable JSON::XS handles this by testing if a scalar has been "stringified" or not, which I think is very cool. But I can't find a way to do this test myself without writing XS, which I'd rather avoid. Is this possible? I can't find this anywhere on CPAN without finding vast pedantry about Scalar::Util::looks_like_number, etc which completely isn't what I want. The only stopgap I can find is Devel::Peek, which feels evil. And also, just like JSON::XS, I'm fine with this secenario: my $a = 5; print $a."\n"; # now $a outputs "5" instead of 5)

    Read the article

1