my $eachQuery = "SELECT * FROM example ORDER BY num; "; my $sth2 = $epm_db->Query($eachQuery); $sth2->execute(); # get example table headings my @eachCols = @{$sth2->{NAME}}; # or NAME_lc if needed my $EachVals = ""; while ( my $dat_ref2 = $sth2->fetchrow_hashref("NAME_lc") ) { foreach my $val(@eachCols) { #print $dat_ref2->{$_}; if ($EachVals eq "") { $EachVals = $dat_ref2->{$val}; } else{ $EachVals = $EachVals."\t".$dat_ref2->{$val}; } } print MYEach "$client\t$EachVals\r"; # printing values into csv output + file }
In reply to looping hash by ibra
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |