The environment associative array: Associative arrays %ENV holds your system's environment variables.
#!/usr/bin/perl -w # Access environment variables. @key_names = keys(%ENV); print "Key names are: @key_names\n\n"; # Now, access each element from the list. foreach $key (@key_names) { print "$key=$ENV{$key}\n"; }