1821409 Members
2542 Online
109633 Solutions
New Discussion юеВ

run perl script error

 
ivychung2
Frequent Advisor

run perl script error

I have install a perl module "DBI" to the RH server ,
now I try a perl script ( the script as below ) then pop the error "-bash: use: command not found" , could advise what is the error mean , is "use" a command in linux ? thx.

#!/usr/bin/perl -w

use DBI;
use strict;
"
"
"
4 REPLIES 4
Nigel Halliday
Occasional Advisor

Re: run perl script error

"use" is a perl command but you need to use the right syntax.

As DBI is a module try this syntax:

#!/usr/bin/perl -w

use DBI ();
use strict;

.
.
.

Hope this helps,

Nigel
ivychung2
Frequent Advisor

Re: run perl script error

thx reply ,

but have the below message , could advise again ? thx



syntax error near unexpected token `('

`use DBI ();'
Alexander Chuzhoy
Honored Contributor

Re: run perl script error

I suggest you to rewrite this little test script from scratch.
You could have some hidden characters in it. I had the same message at a time removing the hidden characters fixed it.
BTW, I have the same module on station installed by default...
Jeroen Peereboom
Honored Contributor

Re: run perl script error

Are you sure /usr/bin/perl exists and is executable?
The error message suggests that bash is processing your perl script, not perl.

So check if /usr/bin/perl exists.
Useful commands to find perl:
locate perl
whereis perl
find / -name perl

Suppose your script is called script.pl. Remove the first line (temporarily) and execute from your bash prompt #:
# perl -w script.pl
If necessary: type full pathname i.s.o. perl, e.g. /usr/local/bin/perl

Also try hello.pl http://www.devdaily.com/perl/edu/articles/pl010001.shtml

Good luck.

JP.

PS.
Check http://forums1.itrc.hp.com/service/forums/helptips.do?#28
;-)