Paid for writing

In case you like my writing and would like me to write for your website, then please leave a comment to any of my blog article, mentioning your Email Id and I will reply back. Thanks

Tuesday, January 20, 2009

Perl code to get a list of environment variables

Simple code in Perl to list the environment variables in Unix.

#!/usr/bin/perl5

foreach $env_key (keys %ENV)
{
print "ENV{$env_key} = $ENV{$env_key}\n";
}

Explanation :

The %ENV stores the list of environment variables in the Unix system.
The above code takes the values and stores it in $env_key and simply displays it

0 comments: