in reply to setting env variable while stroring prev values of that variable

I think you want to do the same as in your shell script:

use strict; use Cwd; my $pwd = getcwd; my $i = 'some_sub_directory'; my $new_path = "$pwd/$i"; $ENV{LSF_PATH} = "$new_path:$ENV{LSF_PATH}";

If you have more than one directory you want to prepend to $ENV{LSF_PATH}, you can use the join function:

my @new_directories = map { "$pwd/$_" } for ('some_dir', 'another_dir'); $ENV{LSF_PATH} = join ":", @new_directories, $ENV{LSF_PATH};