Was I clear this time?
Yes! Thank you for making the effort, and for posting your code which will likely be a blesssing for future Seekers....
I'm translating from Spanish on the fly... ;-)
... and in this case, doing it so well that I think I'm entirely clear about your intent and suspect you know a good deal more about JSON, likely know more about Perl and certainly have had an ups-and-downs intro to the Monastery.
So go forth; sin no more, but confess (with code and data) here if you run into further problems.
If you didn't program your executable by toggling in binary, it wasn't really programming!