foreach my $i (1..$#input) { $script=$input[$i][1].$input[$i][0]; my $compilation_query="\@$script"; print "$compilation_query\n"; my $sth=$db_conn_obj->prepare($compilation_query) or die "prepare err:". $db_conn_obj->errstr; $sth->execute() or die "Cannot execute:".$sth->errstr; }