Hello all,
I want to add to a hash, values read in after a sql sth read.
while (my @data_row = $sth->fetchrow_array){
#$row {'00001'} = {'ITEMDESC' => $data_row[1],
$row {"$data_row[0]"} = {'ITEMDESC' => $data_row[1],
'LISTPRCE' => FormatPrice($data_row[2]),
'ITEMQTY' => $data_row[3],
'IMAGEFILE' => FormatPath($data_row[0])};
}
If I use the commented $row assignment then everything is assigned like it should. But, if I use a variable like the '$row{"$data_row[0]"}...' assignment statement, it doesn't act like I expect it. How do I add to the parent hash? Hrmm..do I have to create the parent hash then add children hash elements to it?
Any help is appreciated.
-t
I want to add to a hash, values read in after a sql sth read.
while (my @data_row = $sth->fetchrow_array){
#$row {'00001'} = {'ITEMDESC' => $data_row[1],
$row {"$data_row[0]"} = {'ITEMDESC' => $data_row[1],
'LISTPRCE' => FormatPrice($data_row[2]),
'ITEMQTY' => $data_row[3],
'IMAGEFILE' => FormatPath($data_row[0])};
}
If I use the commented $row assignment then everything is assigned like it should. But, if I use a variable like the '$row{"$data_row[0]"}...' assignment statement, it doesn't act like I expect it. How do I add to the parent hash? Hrmm..do I have to create the parent hash then add children hash elements to it?
Any help is appreciated.
-t