title: Corrupted JSON encoding in Perl (missign comma)
body: <p>My custom code (on Perl) give next wrong JSON, missing comma between blocks:</p>
  
  <pre><code>{
      "data": [{
          "{#LOGFILEPATH}": "/tmp/QRZ2007.tcserverlogs",
          "{#LOGFILE}": "QRZ2007"
      } **missing comma** {
          "{#LOGFILE}": "ARZ2007",
          "{#LOGFILEPATH}": "/tmp/ARZ2007.tcserverlogs"
      }]
  }
  </code></pre>
  
  <p>My terrible code:</p>
  
  <pre><code>#!/usr/bin/perl
  
      use strict;
      use warnings;
      use File::Basename;
      use utf8;
      use JSON;
      binmode STDOUT, ":utf8";
  
  
      my $dir = $ARGV[0];    
      my $json = JSON-&gt;new-&gt;utf8-&gt;space_after;
      opendir(DIR, $dir) or die $!;
      print '{"data": [';
      while (my $file = readdir(DIR)) {
  
          next unless (-f "$dir/$file");
  
          next unless ($file =~ m/\.tcserverlogs$/);
          my $fullPath = "$dir/$file";
          my $filenameshort = basename($file,  ".tcserverlogs");
  
          my $data_to_json = {"{#LOGFILEPATH}"=&gt;$fullPath,"{#LOGFILE}"=&gt;$filenameshort};
          my $data_to_json = {"{#LOGFILEPATH}"=&gt;$fullPath,"{#LOGFILE}"=&gt;$filenameshort};
          print $json-&gt;encode($data_to_json);
  
      }
  
      print ']}'."\n";
      closedir(DIR);
      exit 0;
  </code></pre>
  
  <p>Dear Team i am not a programmer, please any idea how fix it, thank you!</p>