in reply to create environment variable at run time

also this variable should be available to other script where this env variable is used .

This isn't possible in a straightforward way, as brian_d_foy mentioned. The reason lies in the way environment variables work. Environment variables belong not to a user, or to a "login session," but to a process. Any child process of that process then inherits those variables. So if from your Perl program you call another program through system, qx``, or the piped form of open, then that program will inherit any environment variables that your program has set using %ENV. But any program not launched in that way will not be able to see them without substantial additional work. Also, the follwing code:

open my $fh, "| someotherprog.pl" or die $!; $ENV{FOO} = 'bar';
will not cause someotherprog.pl to see the change to the environment variable FOO.

Win32 has a separate notion of "persistent" environment variables stored in the registry. I am not sure how to manipulate them with Perl, but I am fairly certain that modifying %ENV alone will not do it.