#!/usr/bin/perl $a = 'TEMP'; $x = $ENV{$a}; if ($x =~ m#\QC:\DOCUME~1\z002n88f\LOCALS~1\Temp\E#) {print "cool\n"; } else { print "$x\n" } #### ClientVersion => 2.24.103; value(attached to clientVersion which tells that 2.24.103 of ClientVersion is value) COMPUTERNAME => DEB20ZYC; value(attached to COMPUTERNAME which tells that DEB20ZYC is value ) CommonProgramFiles => C:\Program Files\Common Files; path(attached to CommonProgramFiles which tells that C:\Program Files\Common Files is path ) APPDATA => C:\Documents and Settings\prr2n88f\Appication Data; path(attached to CommonProgramFiles which tells that C:\Documents and Settings\prr2n88f\Appication Data is path ) #### #!/usr/bin/perl use strict; use warnings; use win32::ole; my (%ENV_VAR) = ( 'ALLUSERSPROFILE' => 'C:\Documents and Settings\All Users', 'APPDATA' => 'C:\Documents and Settings\prr2n88f\Appication Data', 'CLEARCASE_PRIMARY_GROUP' => 'wp003\05083_ccuser_g', 'ClientVersion' => '2.24.103', 'CommonProgramFiles' => 'C:\Program Files\Common Files', 'COMPUTERNAME' => 'CAL20ZYC'); my $key = keys %ENV_VAR; my $value = values %ENV_VAR; while (($key, $value) =each %ENV_VAR) { print "$key => $value\n"; } if (exists $ENV_VAR{'ClientVersion'}){ print "this Environment variable is present\n";} else { print "This Environment variable is not present\n" } if ($ENV_VAR{ClientVersion} = $ENV{ClientVersion}) { print "$ENV_VAR{ClientVersion}\n" } else { print "Something is going wrong!!" }