0

In my perl script, use chdir command from Perl iteself works well as following:
chdir $fold_path

but use qx call chdir command of linux doesn't work as following:

qx(chdir $fold_path)

so what is the reason? Not so clear!

Chris Bao
  • 2,418
  • 8
  • 35
  • 62

1 Answers1

3

There are two reasons:

  1. There's no chdir in Linux. It's called cd.

  2. After you change directory in qx, it only affects the child process. It doesn't change the working directory for the parent, i.e. the Perl script that called it.

choroba
  • 231,213
  • 25
  • 204
  • 289