chiron has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I'm trying to loop through a hash reference, it's something to do with it not accepting a hash reference, I get this error and I can't figure out how to workaround it: Using a hash as a reference is deprecated at test.pl line 636. Type of arg 1 to each must be hash (not hash element) at scroll.pl line 636, near "})" Execution of test.pl aborted due to compilation errors. The hash reference has the structure: $config->{ 'DATA' }->( 'different keys' } = value; Here is the code:
while (($key, $value) = each(%$config->{ 'DATA' })) { }
Thanks!

Replies are listed 'Best First'.
Re: Loop through hash reference
by moritz (Cardinal) on Mar 12, 2009 at 08:43 UTC
Re: Loop through hash reference
by planetscape (Chancellor) on Mar 12, 2009 at 11:16 UTC