My SQL database has three columns; Key, Topic, and Value. There are duplicate topics that have different values. Here is a sample:
Key Topic Value
----- ----- -----
1 Book 20
2 Toy 10
3 Toy 30
4 Pet 100
5 Book 15
. . .
. . .
Using Perl, how do I create a hash from the column Topic (%Topic) that uses each unique key in Topic as an array that has the corresponding values for its elements: @Book = 20, 15, ..., @Toy = 10, 30, ..., @Pet = 100, ....
I think you want a hash keyed by Topic, where the value is a reference to an array with the Values for that Topic.