我正在尝试使用 Perl 将数据解析为 MySQL 表。但每次我收到以下错误: Undefined subroutine &main::execute called at all_drug_info.pl line 71 where all_drug_info 是我从不同文件(子程序)获取信息的主文件。当我尝试通过终端上的主文件打印值时,它正在正确打印但未在 MySQL tablel 中解析。下面是我工作的一段代码。请帮我调试这个:
#! /usr/bin/perl
binmode(STDOUT, ":utf8");
use XML::XPath;
require 'drug_characteristics.pl';
my $query3 = "INSERT INTO drug_characteristics VALUES (?,?,?,?,?,?,?,?,?)";
my $query_handle3 = $dbh->prepare($query3);
my ($d_t, $descr, $pm, $ind, $mech, $tox, $gr, $cl, $pha)=&drugCharacteristics(@files);
for(my $a=0; $a< $drug_count ; $a++)
{
#to execute mysql queries:
$query_handle3 = execute($d_t->[$a], $descr->[$a], $pm->[$a], $mech->[$a], $tox->[$a], $ind->[$a], $gr->[$a], $cl->[$a], $pha->[$a]);
print $d_t->[$a], "\n", $descr->[$a], "\n", $pm->[$a], "\n", $ind->[$a], "\n",$mech->[$a], "\n", $tox->[$a], "\n", $gr->[$a], "\n", $cl->[$a], "\n",$pha->[$a], "\n","---------------------------------------------------------------------------------------------------------------------------------------------------------------------","\n";
}