It would be helpful if you would give us what your system is a team and what you get. It's a little hard to say what your mistake is. However, I will assume ..
If you are running Windows and you are doing \ , you should understand that the backslash character is a special quote character in Perl. To use a real backslash, you need to double it:
system ("C:\\Program Files (x86)"\\Microsoft Office\\Word.exe");
Or, even better, use the File :: Spec module that ships with Perl. This ensures that you create the correct path structure:
use File::Spec::Functions; my $executable = catfile("C:", "Program Files (X86)", "Microsoft Office", "Word.exe"); system ($executable);
Of course, you should try to capture the output of the system command to see if there is any error:
my $error = system($executable); if ($error) { if ($? == -1) { print "Program failed to execute\n"; } else { my $signal = ($? & 127); my $exit_code = ($? >> 8); print "Error: Signal = $signal Exit Code = $exit_code\n"; } }
source share