http://qs321.pair.com?node_id=916066


in reply to Perl Calling Perl! :P

One thing to be careful of when running Perl scripts from Perl on Windows (or any other similar language from Windows) is that file association is only done by a shell, like cmd.exe or Windows Explorer. So, if you call system('myscript.pl'); then it probably won't work, since perl will not invoke a shell which it considers unnecessary.

There are several solutions. The simplest is just system('perl myscript.pl'); but that assumes that %path% is set correctly. You could specifically invoke cmd.exe, or, to take an extreme, use Win32::FetchCommand which will do the registry lookup required for file association.

UNIX style operating systems don't have this issue because of the #! line.

Replies are listed 'Best First'.
Re^2: Perl Calling Perl! :P
by bingos (Vicar) on Jul 22, 2011 at 09:48 UTC

    Or you can use $^X

    system($^X, 'myscript.pl');