title: Passing a hashref to a sub
body: <p>My code is as follows super simplistic but I am just not getting it to work as intended.</p>
  
  <pre><code>use strict;
  use warnings;
  use CGI::Carp qw(fatalsToBrowser);
  use CGI qw(-dubug);
  use warnings;
  use diagnostics;
  use strict;
  use JSON;
  use Data::Dumper;
  
  my $q = CGI-&gt;new;
  
  my $data = $q-&gt;param('POSTDATA');
  my $data_hash;
  
  if (defined($data)) {
  $data_hash = decode_json($data);
  }
  
  sub test {
      my $return_hash = shift;
  
      return \$return_hash;
  }
  
  my $return_to_print = test($data_hash);
  
  print $q-&gt;header();
  print "This is a test: \n";
  print Dumper($return_to_print);
  </code></pre>
  
  <p>Basically I am sending json to the perl script, I decode the json into a hashref, then id like to pass that data to the test sub who just does nothing more than return it back so the cgi can print it, all while keeping its structure. So far I am unsuccessful and I am hoping someone can shed some light on how to properly write something like this.</p>
  
  <p>So in the end dumper should print something like:</p>
  
  <pre><code>$VAR1 = { 'key' =&gt; 'value', 'key2' =&gt; 'value' };
  </code></pre>