title: Perl - How can I turn a hash into a query string?
body: <p>How can I turn a hash into a query string? I would like to find a solution that doesn't involve using the CGI module. Here's an example of what I'm wanting to do but don't know what the best and most elegant approach would be, since I'm relatively new to Perl. </p>
  
  <p>Hash:</p>
  
  <pre><code>my $data = {
           'key1' =&gt; 'value1',
           'key2' =&gt; 'value2',
           'key3' =&gt; 'value3',
           'key4' =&gt; 'value4'
  };
  </code></pre>
  
  <p>To desired query string:</p>
  
  <pre><code>key1=value1&amp;key2=value2&amp;key3=value3&amp;key4=value4
  </code></pre>