in reply to creating a table hash
First of all, a helpful hint about posting successfully: narrow down the problem you're having as tightly as possible. Demonstrate the trouble and explain the results of your attempts as succinctly as you can, and please provide references to helpful material, such as this article. According to the documentation, your call to ct_sql will return an array of references to rows, perhaps something like this:
So it seems like your implementation in systemNames should work:my @array = ([1,2], [3,4], [5,6]);
What (wrong) behavior are you seeing when you do this?@rows = $dbAdo->ct_sql($sql); foreach $row (@rows) { $main::systemNames{$row->[0]} = $row->[1]; }
Once you've got that working with a foreach loop, you might try map for a nicer solution:
Where map runs through each element of @array, setting $_ each iteration to the current element (an array reference), which you can then dereference and pull apart before inserting the results into a hash.my %hash = map { $$_[0] => $$_[1] } @array;
|
|---|