what kind of data sturcture is this ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ravikim1
    New Member
    • Nov 2009
    • 3

    what kind of data sturcture is this ?

    I have a the following code snippet :
    Code:
       foreach my $table (keys %config::db_columns)
        {
    	my $select_stmt = 'select ' . lc(join(',', @{$config::db_columns{$table}}));
    
    	$select_stmt .= " from $table";
    	if ($table eq 'employeeview') { $select_stmt .= ' where present=1'; }
    
            my %db_data = undef;
    	$sth = $dbh->prepare("$select_stmt");
    	if ($sth->execute)
    	{
    	    my $n = 0;
    	    while (my $hashref = $sth->fetchrow_hashref)
    	    {
    		foreach my $column (@{$config::db_columns{$table}})
    		{
    		    $db_data{$table}[$n]{$column} = $$hashref{$column};
    		}
    		$n++;
    	    }
    	}
        }
        print "Database upload completed.\n";
    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 ?
    Last edited by numberwhun; Jan 4 '10, 09:54 PM. Reason: Please use code tags!
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    That is a nested Hash structure. To learn more about them via examples, check out this link.

    Regards,

    Jeff

    Comment

    • ravikim1
      New Member
      • Nov 2009
      • 3

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

      Comment

      • numberwhun
        Recognized Expert Moderator Specialist
        • May 2007
        • 3467

        #4
        You are right, I missed the middle brackets. :)

        Comment

        Working...