By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,809 Members | 1,997 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,809 IT Pros & Developers. It's quick & easy.

what kind of data sturcture is this ?

P: 3
I have a the following code snippet :
Expand|Select|Wrap|Line Numbers
  1.    foreach my $table (keys %config::db_columns)
  2.     {
  3.     my $select_stmt = 'select ' . lc(join(',', @{$config::db_columns{$table}}));
  4.  
  5.     $select_stmt .= " from $table";
  6.     if ($table eq 'employeeview') { $select_stmt .= ' where present=1'; }
  7.  
  8.         my %db_data = undef;
  9.     $sth = $dbh->prepare("$select_stmt");
  10.     if ($sth->execute)
  11.     {
  12.         my $n = 0;
  13.         while (my $hashref = $sth->fetchrow_hashref)
  14.         {
  15.         foreach my $column (@{$config::db_columns{$table}})
  16.         {
  17.             $db_data{$table}[$n]{$column} = $$hashref{$column};
  18.         }
  19.         $n++;
  20.         }
  21.     }
  22.     }
  23.     print "Database upload completed.\n";
  24.  
could some tell me what kind of datastucture is $db_data{$table}[$n]{$column} ?

and some insight of what does the developer intend to do ?
Jan 4 '10 #1
Share this Question
Share on Google+
3 Replies


numberwhun
Expert Mod 2.5K+
P: 3,503
That is a nested Hash structure. To learn more about them via examples, check out this link.

Regards,

Jeff
Jan 4 '10 #2

P: 3
Hi thanks for your reply...the link was very help ful....
also I feel that it is an hash of array of hashes.....
Jan 7 '10 #3

numberwhun
Expert Mod 2.5K+
P: 3,503
You are right, I missed the middle brackets. :)
Jan 7 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.