Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, I am trying to call perl script from another using system() without succes.

can't exec "/home/my_folder/perl_script/rebelotte.pl":permission denied at myscript.pl line 153,<STDIN> line 2.

my file permissions : rw and i'm loggin as root

if($tab[-1] != $tab[-2]) { system("/home/my_folder/perl_script/rebelotte.pl"); exit; }
Please help thank's in advance

Replies are listed 'Best First'.
Re: call perl script from another
by Ratazong (Monsignor) on Feb 03, 2010 at 11:24 UTC
    To execute a script, the permission "rw" is not sufficient - you need also to set the permission to "x".
    HTH, Rata
      when i set the permission to"x" it gives another err:

      can't exec "/home/my_folder/perl_script/rebelotte.pl": No such file or directory at myscript.pl line 153,<STDIN> line 2.

        Assuming you had tested the obvious and the script pathname is correct, then check the #! line in the script you are calling. Some shells can report that error message if they cannot find the program in the line. A common error is to miss out the leading /, as in:
        #! usr/bin/perl ## << wrong!
        Have you doublechecked that /home/my_folder/perl_script/rebelotte.pl is existing? And that there is no typo in the path?
        Have you tried to execute it (with the full path!) from your unix-shell?
Re: call perl script from another
by 7stud (Deacon) on Feb 03, 2010 at 12:01 UTC

    To execute a file, you need...wait for it...execute privileges. :)

    r: read w: write x: execute

    If you are in the directory perl_script, you can add privileges like this:

    $ chmod a+x rebolette.pl

    That adds 'x' privileges for 'all' accounts: user, group, others.

      thank's 7stud, but it doesn't work

        What error are you getting? What are the file permissions now (give "ls -l" and "stat" output).

        You've mentioned two completely different errors so far:

        • "permission denied" (which I think you got because the file did not have the execute bit set; the permissions were probably 644 (-rw-r--r--).
        • "no such file or directory" (which sounds like you removed or renamed the file).

        You could also use diagnostics which will give a more verbose error message.

        nm -- already solved