in reply to no database driver specified and DBI_DSN env var not set at

Maybe instead of:
my $dsn = "@array[0], '@array[1]', '@array[2]'";

try:

my $dsn = "$array[0], '$array[1]', '$array[2]'";
to call those array elements individually next time. I am not sure that is your final problem though...