Q&A > programs and processes > How to run a shell script from a Perl program? - Answer contributed by snapdragon

The way to do this is to use a systen call to run your script:


However I thought that I'd mention a couple of points to go with this.

  1. Don't assume that your shell environment variables will be kept - a shell script that works fine on the command line may not work when run from Perl
  2. Be careful with your directories - try to make sure you're executing from the right place. It's often worthwhile to do a chdir to the right directory in Perl before calling your script. i.e.  chdir "/path/to/script/";

Good luck!