Perl Add Directory to Path

Say you have a directory d:bin and you want to add it to path environment at the beginning of your Perl script. Following code will do the trick.

my $dir="d:\bin";
$ENV{PATH}.=";$dir";

Then $dir will be included in new $ENV{PATH}


Comments

5 responses to “Perl Add Directory to Path”

Leave a Reply