in reply to Re^2: Loop is not working
in thread Loop is not working

In general, I would not do a chdir from the Perl script and prefer to use a path name. But if you do a chdir, you should check for success.
Did chdir  "/mnt/hgfs/ExpAutism/Scripts"; work? -> check the result of all file system operations.

In general, I've found that changing the running default directory causes more problems than it fixes. Just a thought.

Replies are listed 'Best First'.
Re^4: Loop is not working
by haukex (Archbishop) on Oct 04, 2018 at 07:24 UTC

    I completely agree that absolute pathnames and writing scripts to be independent of the current working directory is a good thing. In addition to error checking, I'd also recommend using a module to make operations on filenames platform independent (File::Spec, Path::Class, Path::Tiny, etc.).

    Unfortunately, external programs aren't always written like that, and may depend on the current working directory (just one example of many would be git). In those cases, I like to use File::pushd to make changes to the current working directory temporary.