title: Why does Perl's strict not let me pass a parameter hash?
body: <p>I hava a perl subroutine where i would like to pass parameters as a hash
  (the aim is to include a css depending on the parameter 'iconsize').</p>
  
  <p>I am using the call:</p>
  
  <pre><code>get_function_bar_begin('iconsize' =&gt; '32');
  </code></pre>
  
  <p>for the subroutine get_function_bar_begin:</p>
  
  <pre><code>use strict;
  ...
  sub get_function_bar_begin
  {
      my $self = shift;
      my %template_params = %{ shift || {} };
  
      return $self-&gt;render_template('global/bars   /tmpl_incl_function_bar_begin.html',%template_params);
  }
  </code></pre>
  
  <p>Why does this yield the error message:</p>
  
  <p><strong>Error executing run mode 'start': undef error - Can't use string ("iconsize") as a HASH ref while "strict refs" in use at CheckBar.pm at line 334</strong></p>
  
  <p>Am i doing something wrong here?
  Is there an other way to submit my data ('iconsize') as a hash?</p>
  
  <p>(i am still new to Perl)</p>
  
  <p><strong>EDIT: Solution which worked for me</strong>. I didn't change the call, but my function:</p>
  
  <pre><code>sub get_function_bar_begin
  {
      my $self = shift;
      my $paramref = shift;
      my %params = (ref($paramref) eq 'HASH') ? %$paramref : ();
      my $iconsize = $params{'iconsize'} || '';
  
      return $self-&gt;render_template('global/bars/tmpl_incl_function_bar_begin.html',
          {
              'iconsize'  =&gt; $iconsize,
          }
      );
  }
  </code></pre>