in reply to Exec() argument format

It could be that ComLine.pl is not executable or not on your PATH. Assuming ComLine.pl is in your current working directory, you might try:

exec($^X, "ComLine.pl", @args);
where $^X is the name of the running perl interpreter (if ComLine.pl is not in your current working directory, use an absolute path instead).

Update: You should also add a line something like:

die "exec failed: $!";
immediately after the exec line, because if the exec works you should not get to the next line.

Replies are listed 'Best First'.
Re^2: Exec() argument format
by MonkPaul (Friar) on Jul 25, 2005 at 21:31 UTC
    ok, thankyou

    but just for clarifictaion can you give me an example of $^X in use.

    cheers, MonkPaul.

      $^X is just a special variable, and it contains a string representing the full path to the current Perl interpreter. This is very helpful if you have more than one Perl installed.

      For example, try running the following:

      perl -e 'print $^X'

      On the Win32 machine I'm using here at work, with ActiveState Perl, this prints:

      C:\Perl\bin\perl.exe
      
      <-radiant.matrix->
      Larry Wall is Yoda: there is no try{} (ok, except in Perl6; way to ruin a joke, Larry! ;P)
      The Code that can be seen is not the true Code
      "In any sufficiently large group of people, most are idiots" - Kaa's Law