in reply to Changing an environment variable

You do not say which operating system, so:
use warnings; use strict; my $sep = $^O eq 'MSWin32'?';':':'; $ENV{'PATH'} .= $sep . "directory to be added";
Note: this will only affect processes that the Perl script itself starts, using, for example, system or qx, it will not affect any others.

You do not make clear what PATH has to do with its input file. Is the inout file a script you are running?