MySQL Forums
Forum List  »  Perl

Getting error in Perl scipt
Posted by: Padmaja T N
Date: September 26, 2007 12:07AM

Hi all,
I'm new to Perl as well as asterisk technology. Am writing a test program for perl connecting to MySql in asterisk. when i tried to debug that, it's displaying error as follows.

select_test.pl: line 4: use: command not found
select_test.pl: line 5: use: command not found
select_test.pl: line 10: =: command not found
select_test.pl: line 28: =: command not found
select_test.pl: line 30: =: command not found
select_test.pl: line 32: =: command not found
select_test.pl: line 34: =: command not found
select_test.pl: line 36: syntax error near unexpected token `('
select_test.pl: line 36: `$dbh =DBI->connect("DBI:mysql:dbname=$database;host=$hostname", "$username", "$password");'



The perl script is:
*********************


#!/usr/bin/perl -Tw


use DBI;
use File::Copy;

# the name of the extensions table
$table_name = "test";
# the name of the box the MySQL database is running on
$hostname = "192.168.1.99";
# the name of the database our tables are kept
$database = "asterisk";
# username to connect to the database
$username = "root";
# password to connect to the database
$password = "aDfasoAd12";
#print "Connecting to database\n";
$dbh = DBI->connect("dbi:mysql:dbname=$database;host=$hostname", "$username", "$password");




$statement = "SELECT data from $table_name";

my $result = $dbh->prepare($statement);


$result->execute();
exit;





***************************************************************
Please let me know where the error is.

Thanks in advance.
Padmaja T N.

Options: ReplyQuote


Subject
Written By
Posted
Getting error in Perl scipt
September 26, 2007 12:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.