#!/usr/bin/perl -w use strict; my $Reg; use Win32::TieRegistry ( TiedRef => \$Reg, ArrayValues => 1, Delimiter => '/', ':REG_' ); # this is the system environment variable area my $SysEnv= $Reg->{"LMachine/System/CurrentControlSet/Control/" . "Session Manager/Environment/"} or die "Can't open Registry key, Session Manager/Environment: $^E\n"; # create a new value and set it's data $SysEnv->{"/bob"} = "test system"; # # this is the user environment variable area # my $UserEnv= $Reg->{"CUser/Environment/"} # or die "Can't open Registry key, CUser/Environment: $^E\n"; # # create a new value and set it's data # $UserEnv->{"/bob"} = "test user";