3 #Write a program to list all of the keys and values in %ENV. Print the
4 #results in two columns in ASCIIbetical order. For extra credit, arrange the
5 #output to vertically align both columns. The length function can help you
6 #figure out how wide to make the first column. Once you get the program
7 #running, try setting some new environment variables and ensuring that they
8 #show up in your output.
16 foreach my $key (sort(keys %ENV)) {
17 if (length($key) > $maxlen) {
18 $maxlen = length($key);
21 foreach my $key (sort(keys %ENV)) {
22 printf "%${maxlen}s => %s\n", $key, $ENV{$key};