I am new to Perl, and I am writing a script to fetch some rows from a database:
my @rows = $conn->fetchrow_array(1,2,3);
the result will be three rows of single column.
12345
56789
12376
How should I join them together as 12345,56789,56789
I tried,
my $list = join ",", @rows.
Result: ARRAY(0x14f6de0),ARRAY(0x1508a90),ARRAY(0x15014c0)
Going through a foreach loop just print the results with a new line:
12345
56789
12376
What am I doing wrong ? have I got the concept of fetchrow_array wrong?
Each row is a reference to an array (because each row could contain multiple columns). Something like the following should work.
However, you are better off using
selectcol_arrayref: