Thread: Error - Arrays must contain only scalars and other arrays when array element is an array

I have the interesting issue as per subject line

SOURCE data (perl DBD::Pg)

my $testdatasql=<<~'SQLSTR';
SELECT fileid,tagname,tagvalue--array_to_string(tagvalue,E'\b')
FROM tagdata_all
where tagvalue is not null
limit 100
SQLSTR
my $testdata=$dbh->selectall_arrayref($testdatasql);
my @testdata=@{$testdata};

Then with unnest

my $testinssql2=<<~'SQLSTR';
TRUNCATE TABLE testunnest;
SELECT elem,nr FROM UNNEST ($1::text[][]) WITH ORDINALITY AS a(elem,nr)
SQLSTR
my $chk=$dbh->selectall_arrayref ($testinssql2,undef,\@testdata);

@testdata is a two-dimensional array with the second dimension being
int, text and text[] (array)

Any ideas?