I am running perl under Windows 7 x86 and I get an error when I call subroutine which execute external commands from another script.
I have two scripts, script1 has a subroutine that executes a program (patt.exe) and script2 that use this subroutine via require.
When I run script1, it works properly. But when I try to use this subroutine from inside script2, I get the following error.
Error:
'patt.exe' is not recognized as an internal or external command, operable program or batch file.
script1:
#patt('file.txt');
sub patt {
my $filename=shift@;
system("cmd.exe /c patt.exe -S $filename");
}
1;
script2:
require 'sub-directory/script1.pl';
patt('file.txt');
I should mention that script1 and patt.exe are located in the sub-directory (require 'sub-directory/script1.pl';) and when I put all files in same directory ( require 'script1.pl';) everything works correctly. This problem remains if I use qx or when I pass arguments to the script as array.
I would be very thankful if anyone could help me.
-f "patt.exe" or die "must be in some other folder";right beforesystemcall