Config::Simple Perl module loop through hash
<p>I'm using Config::Simple for my App config, I have created <code>Stats_feeder.cfg</code> that has a block <code>[stats_interval]</code></p>

<pre><code>[stats_interval]
1m = 60
15m = 900
</code></pre>

<p>And my perl script  <code>script.pl</code></p>

<pre><code>my $cfg = new Config::Simple('stats_feeder.cfg') or die Config::Simple-&gt;error();

my $hash = $cfg-&gt;get_block('stats_interval');
</code></pre>

<p>When I run <code>print Dumper($hash);</code> I get </p>

<pre><code># perl stats_feederv2.pl
$VAR1 = {
          '1m' =&gt; '300',
          '15m' =&gt; '900',
          '60m' =&gt; '3600',
          '30m' =&gt; '1800'
        };
</code></pre>

<p>I can access values using  <code>$val = $cfg-&gt;param('1m');</code></p>

<p>I'm trying to loop through this hash and print keys and values, I have tried the following: </p>

<pre><code>foreach my $key ( keys %$hash )
{

  print "key $key value $hash{$key}\n";

}
</code></pre>

<p>I keep getting </p>

<pre><code>Global symbol "%hash" requires explicit package name at stats_feederv2.pl line 42.
Execution of stats_feederv2.pl aborted due to compilation errors.
</code></pre>