$content =~ s/\/\///; ## had to remove // in front
into $content =~ s{\A//}{}; ## remove // at the beginning of the json cont
+ent
... where I used the s{}{} notation to avoid leaning matchstick syndrome (thus avoid escaping the / as \/, ie, leaning matchsticks: see perldoc perlop Quote and Quote-like Operators). I also added the \A beginning-of-string anchor (see perlre, search for "Assertions"), because your regexp would have deleted the first //, whether it's at the beginning, or embedded in important data in your json. If there might be spaces before the //, then $content =~ s{\A\s*//}{}; ## remove // at the beginning of the json c
+ontent
| [reply] [d/l] [select] |
Sidebar, comments are illegal in JSON so what you are handling is not JSON and neither is the "Json text" in your original __DATA__. decode_json was surely telling you so with malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "Json text") or garbage after JSON object.
If it were me, I'd report it to the owner of the application issuing it. Issuing, and accepting if you can help it, broken data is a worst practice.
| [reply] [d/l] |