%$tabledesc->{$_} is confused ... Try writing it like :
%{ $tabledesc->{$_} } HTH, José. -----Original Message----- From: Andrew Gaffney [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 03, 2004 2:50 PM To: beginners Subject: iterating through hash of hash references I have a script which creates a hash where all the values are hash references. I'm trying to iterate through the original hash and down into the anonymous hashes to make sure my code is doing what I think it's doing. My problem comes in at those nested foreach loops before the DB disconnect. I get the error: Using a hash as a reference is deprecated at ./modtables.pl line 24. Type of arg 1 to keys must be hash (not hash element) at ./modtables.pl line 24, near "})" <code> #!/usr/bin/perl use Skyline; # Custom module use strict; use warnings; my @tables; my $dbh = init_db(); # Custom function to connect to MySQL DB my ($sth, $ref, $tabledesc); get_table_list(); foreach (@tables) { $tabledesc = {}; $sth = $dbh->prepare("DESCRIBE $_"); $sth->execute; while($ref = $sth->fetchrow_hashref) { $tabledesc->{$ref->{Field}} = {type => $ref->{Type}, null => $ref->{Null}, key => $ref->{Key}, default => $ref->{Default}, extra => $ref->{Extra} }; } foreach (keys %$tabledesc) { foreach (keys %$tabledesc->{$_}) { print "$_ = $tabledesc->{$_}, "; } print "\n"; } } $dbh->disconnect(); sub get_table_list { $sth = $dbh->prepare("SHOW TABLES"); $sth->execute; while($ref = $sth->fetchrow_hashref) { push @tables, $ref->{'Tables_in_skyline'} if($ref->{'Tables_in_skyline'} =~ /^m\d{6}$/); } } </code> -- Andrew Gaffney Network Administrator Skyline Aeronautics, LLC. 636-357-1548 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> **** DISCLAIMER **** "This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the recipient(s) named above. Any use of the information contained herein (including, but not limited to, total or partial reproduction, communication or distribution in any form) by other persons than the designated recipient(s) is prohibited. If you have received this e-mail in error, please notify the sender either by telephone or by e-mail and delete the material from any computer". Thank you for your cooperation. For further information about Proximus mobile phone services please see our website at http://www.proximus.be or refer to any Proximus agent. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>