my %row; # Column binding is the most efficient way to fetch data while ($sth->fetch) { $row{$config{'MySQL.table'}}{$column_1} = $column_2; } $ perl test.pl Database: PerlMonks exists not creating: PerlMonks Table: Data exists not creating: Data $VAR1 = { 'Data' => { 'value-1 Column1' => 'value-1 Column2', 'value-3 Column1' => 'value-3 Column2', 'value-2 Column1' => 'value-2 Column2' } };