Did you read the perlsec and perldiag documentation? They describe tainting and the error message. It says that "you need to set $ENV{'PATH'} to a known value, and each directory in the path must be non-writable by others than its owner and group." My guess is that permissions on the
directory you are adding is the problem.