in reply to Re^4: EXEC fails, sometimes
in thread EXEC fails, sometimes

On a Windows machine? Try exec 'perl', 'print_2.pl';. Use the full path to perl if necessary.

Replies are listed 'Best First'.
Re^6: EXEC fails, sometimes
by simpsope (Initiate) on Dec 16, 2005 at 13:54 UTC
    Success! Fully qualifying the Perl directory fixed the problem. This worked OK:
    exec 'c:\perl\bin\perl print_2.pl';
    The path string is different, and in fact incorrect, on the machine where it fails. The real solution is to fix the path string so the code is not machine-dependent. Thanks!
      Again,
      exec 'c:\perl\bin\perl print_2.pl';
      is more security prone and slower than
      exec 'c:\perl\bin\perl', 'print_2.pl';
      since a shell is involved in the top snippet.

      Also, if you're going to put the whole path, you might as well add ".exe" to speed things up slightly.

        Again, thanks.