in reply to Exec() argument format

Is ComLine.pl executable?

What is the value of $! after the failed call?
exec('ComLine.pl', @args ) or die "Can't exec: $!";
Aside, you'll generally want to use system rather than exec because exec never returns. Instead, it replaces the currently running program with the program passed as the first parameter.

If you have any code that follows the call to exec, you should use system instead.

Please see perlfunc for details about the return values from exec and system.

--sacked

Replies are listed 'Best First'.
Re: Exec() argument format
by MonkPaul (Friar) on Jul 25, 2005 at 21:52 UTC
    Ok, it says cannot execute - No such file or directory.
    ALthough im passing in the file off command line anyway.

    The ComLine.pl is executable. Im at a loss here.

    I was thinking of using system() but there is no code afterwards and im printing out to a web page in anothe file so i didnt want to lock anything.

      As suggested by eyepopslikeamosquito above, consider using the full path to the ComLine.pl program:
      exec( '/path/to/ComLine.pl', @args ) or die "exec: $!"
      or invoke the Perl interpreter ($^X, documented in perlvar), also suggested above.

      --sacked
        Sure but both my files are in the same location. i guess the $^Xsolution is the next best bet.