Your @ref_db_data is going to be a one-element array with an array reference as that one element. There's nothing wrong with that, but it might not be what you really want.
I'm guessing what you're shooting for is this:
my $ref_header = [ 'Name', 'Surname' ];
my @ref_db_data = @{ $sth->fetchall_arrayref };
unshift @ref_db_data, $ref_header;
Or maybe this:
my $ref_header = [ 'Name', 'Surname' ];
my $ref_db_data = $sth->fetchall_arrayref;
unshift @{ $ref_db_data }, $ref_header;
Here's your original situation:
my @ref_header = (
[ ["Name", "Surname"] ],
);
...
@ref_db_data = $sth->fetchall_arrayref;
unshift @{$ref_db_data[0]}, $ref_header[0]->[0];
...but I'm not sure if that's what you're shooting for. You wind up with something like:
@ref_db_data = ( [ [ 'Name', 'Surname' ],
[ 'John', 'Doe' ],
[ 'Jane', 'Smith' ]
]
);
|