title: Json Sort in Perl
body: <p>I need to sort json values which is in array elements. I need to sort by json field id. Is it possible to sort?</p>
  
  <p>Can please anyone help in this case?</p>
  
  <p>Kindly find below code.</p>
  
  <pre><code>$json1 = '{"id":"3","name":"John", "age":31, "city":"New York" }';
  $json2 = '{"id":"2","name":"Prem", "age":26, "city":"India" }';
  $json3 = '{"id":"4","name":"Mark", "age":27, "city":"USA" }';
  $json4 = '{"id":"1","name":"Anto", "age":28, "city":"UK" }';
  @array_of_json = ($json1,$json2,$json3,$json4);
  </code></pre>
  
  <p>After sorting by id, Need Output like this,</p>
  
  <pre><code>{"id":"1","name":"Anto", "age":28, "city":"UK" }
  {"id":"2","name":"Prem", "age":26, "city":"India" }
  {"id":"3","name":"John", "age":31, "city":"New York" }
  {"id":"4","name":"Mark", "age":27, "city":"USA" }
  </code></pre>