2

I have a set of .EXE commands. How do I get all those commands run in Perl as a single file? Whats the process to call the .EXE files in Perl?

brian d foy
  • 129,424
  • 31
  • 207
  • 592
Anil
  • 3,912
  • 5
  • 35
  • 46

2 Answers2

5

The Perl system() function will do this:

#!/usr/bin/perl -w

system("prog1.exe");
system("prog2.exe");
Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
  • don't forget to check exit codes from your system command, you might not want to run prog2 if prog1 failed – Oskar Jan 23 '09 at 08:50
3

TThe way to call system commands from perl is to use

system("String containing command + args here")

or if you want to perform some processing on the output, you use backticks

`command + args here`

You can use all your normal perl string manipulation oneliners with the backtick as well.

workmad3
  • 25,101
  • 4
  • 35
  • 56