Dear All, I have a hash %region_data which looks like :
$VAR1 = {
'south' => {
'status' => {
'open' => {
'count' => 3
},
'pws' => {
'count' =>
3
},
'wip' => {
'count' => 0
},
'hold' => {
'count' => 1
},
're-open' => {
'count' => 0
},
'pwu' => {
'count' => 0
},
'openesc' => {
'count' => 0
}
},
'total_count' => 7
},
'north' => {
'status' => {
'open' => {
'count' => 3
},
'pws' => {
'count' =>
0
},
'wip' => {
'count' => 0
},
'hold' => {
'count' => 7
},
're-open' => {
'count' => 0
},
'pwu' => {
'count' => 0
},
'openesc' => {
'count' => 0
}
},
'total_count' => 10
},
}
I want to insert the hash values like this in mysql data base
region open pws wip hold re-open pwu openesc total_coun
south 3 3 0 1 0 0 0 7
north 3 0 0 7 0 0 0 10
using below query:
my $query = "INSERT INTO by_region
(region,open,pws,wip,hold,re-open,pwu,openesc,total_count) VALUES
(?,?,?,?,?,?,?,?,?)";
I am trying some thing like to print :
foreach my $line (keys %region_data)
{
print "$line\n";
foreach my $item (keys %{$region_data {$line}})
{
print "$item\n";
}
}
Output :
south
status
total_count
north
status
total_count
west
status
total_count
east
status
total_count
But I don't know how to print next level. I need someone help to point
right direction.
Thanks & Rg
Mohan L
