in reply to Help looping through hash

use strict; catches your error. You switch from using %site_information to using %$site_information

By the way, to dump hashes, pass a reference to the hash to Dumper (e.g. Dumper(\%hash)). What you did isn't as readable.

Replies are listed 'Best First'.
Re^2: Help looping through hash
by dbmathis (Scribe) on May 14, 2011 at 00:44 UTC

    I don't follow, I am making use of use strict and there is nothing being caught. I have done it like this many times. What happens here is that the inner loop simple doesn't iterate. The second for loop switches to $site_information because I am using %{}. Can you give me an example?

    After all this is over, all that will really have mattered is how we treated each other.

      I don't follow, I am making use of use strict and there is nothing being caught

      Then you've discovered why it's a bad idea to have a two identically-named global variables (%site_information and $site_information).

      This was the fix

      sub get_rc_site_information { for my $instance ( keys %site_information ) { print $instance; for my $schema ( keys %{ $site_information{ $instance } } ) { print $schema; my $channel_query = qq(select
      After all this is over, all that will really have mattered is how we treated each other.