title: How do I encode a simple array into JSON in Perl?
body: <p>All the examples that I've seen of encoding objects to JSON strings in Perl have involved hashes. How do I encode a simple array to a JSON string?</p>
  
  <pre><code>use strict;
  use warnings;
  use JSON;
  my @arr = ("this", "is", "my", "array");
  my $json_str = encode_json(@arr);  # This doesn't work, produced "arrayref expected"
  
  # $json_str should be ["this", "is", "my", "array"]
  </code></pre>