user1876128
user1876128

Reputation: 91

running a program in linux from perl

I want to run a program from perl by using system command(or any other ways ).

system("samtools");

I think it should pass this to shell but it complains ,Can't exec "samtools" file or directory does not exist , when I run it.I have tried many other different program for example

system("velveth");

and it works properly but not this one (samtools). Is any of you facing this problem before? I am really puzzled.

Upvotes: 0

Views: 247

Answers (3)

Alec
Alec

Reputation: 1188

Did you modify $path for samtools in the current shell manually?

Since system starts a new sub-shell to run your command, you have to append search path for samtools yourself if doesn't exist in your .bashrc. Check it by:

perl -e 'system("echo \$PATH")'

and

echo $PATH

to see if there's any difference.

Upvotes: 0

Guardian
Guardian

Reputation: 168

Try putting Linux command inside `` characters. Will work as well.

Upvotes: 0

Deiveegaraja Andaver
Deiveegaraja Andaver

Reputation: 840

You can give the full path to that file location.

example:

system( "/usr/bin/perl -de 1");

Upvotes: 2

Related Questions