Oops, I think I accidentally removed that closing curly brace for the loop there. I originally posted the without using any HTML tags and went back to adjust the post manually... got a little too carried away.

You are probably right, spawning new processes is always expensive, and making this only once shows that Perl runs much faster. I would like to play with hyperfine as suggested above, so I might try that when I have something a bit more meaningful to test on.

The "benchmark" was just for fun, thought, to see how Python and Perl compare. What I'm more concerned is with the correctness of the script, specifically how the JSON is processed. As I said, I find this syntax a bit strange: (@$decoded). I couldn't figure it out without looking for answers online and I'm not sure if there's perhaps a better way to tell Perl that this is an array (assuming that I know in advance the structure of the JSON to be returned)?


In reply to Re^2: Adjusting variable context when working with JSON data? by unmatched
in thread Adjusting variable context when workign with JSON data? by unmatched

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.