I am trying to put data into an Array of Arrays for use in DBD::AnyData.
Since the size of the table varies, I am creating it in the following manner:
$test[0][0] = 'No';
$test[0][1] = 'Letter';
$test[0][2] = 'Roman';
$test[1][0] = 1;
$test[1][1] = 'a';
$test[1][2] = 'i';
$test[2][0] = 2;
$test[2][1] = 'b';
$test[2][2] = 'ii';
$test[3][0] = 3;
$test[3][1] = 'c';
$test[3][2] = 'iii';
$test[4][0] = 4;
$test[4][1] = 'd';
$test[4][2] = 'iv';
$test[5][0] = 5;
$test[5][1] = 'e';
$test[5][2] = 'v';
$test[6][0] = 6;
$test[6][1] = 'f';
$test[6][2] = 'vi';
$dbh = DBI->connect('dbi:AnyData(RaiseError=>1):');
$dbh->func( 'testtable', 'ARRAY', @test, 'ad_import');
This gives the following error:
Can't coerce array into hash at C:/Perl/site/lib/DBD/AnyData.pm line 247.
I don't currently see what the difference is from the following (which works):
@test = [
['No','Letter','Roman'],
[1,'a','i'],
[2,'b','ii'],
[3,'c','iii'],
[4,'d','iv'],
[5,'e','v'],
[6,'f','vi']
];
$dbh = DBI->connect('dbi:AnyData(RaiseError=>1):');
$dbh->func( 'testtable', 'ARRAY', @test, 'ad_import');
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.