in reply to DBD::Sybase, selectall_arrayref "Not a SCALAR reference" error

You didn't tell us what line 108 is in your code, but I'm sure when you go and look, it will be this line:

my $values_array=${$dbh2->selectall_arrayref($query1)};

This is because $dbh2->selectall_arrayref($query1) does return a reference to an array, and not a scalar. Did you mean

my $values_array = $dbh2->selectall_arrayref($query1)
?