user2818537
user2818537

Reputation: 159

Perl mysql parsing

I am trying to parse data to MySQL tables using Perl. But everytime I am getting the following error: Undefined subroutine &main::execute called at all_drug_info.pl line 71 Where all_drug_info is the main file through which I am fetching information from different file(subroutine). When I tried to print values through main file on terminal, it is printing properly but not parsing in the MySQL tablel. Below is the piece of code for my work. Please help me in debugging this:

#! /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";
}

Upvotes: 1

Views: 354

Answers (1)

Toto
Toto

Reputation: 91385

Instead of:

$query_handle3 = execute($d_t->[$a], .....

use:

$query_handle3->execute($d_t->[$a], .....

Upvotes: 3

Related Questions