in reply to Re^2: strings to json
in thread strings to json

It's only broken if you change the other code so $name, etc are different.

But if you change the surrounding code, it's possible to break anything.

Replies are listed 'Best First'.
Re^4: strings to json
by ikegami (Patriarch) on Jun 25, 2017 at 03:35 UTC

    Are you seriously going to argue the inputs are constant? If you really believe that, why did you post such stupid solutions? You should have suggested

    use strict; use warnings; print '{ "mike": 20, "johndeo@test.com": "test" }';

    But no, the OP used variables for a reason. It's because they are variable. And because of that, your first solution is buggy.

      Its what the OP wants

        Which one? Buggy solutions or stupid solutions?