CIS 33A Perl handout week 11 part 3

CIS 33 perl
Lecture week 11 hour 3
Only part, 1/2 hour
Total for lecture 1/2 hours for Nguyen

Do after Chapter 13

This lecture contains optional topics that are not in the 2013 Course Outline.

Topics:
Environmental variables
Building Libraries
eval
Sample environmental variable program
from Clare Nguyen
*******************************************************

Environmental variables

The UNIX environmental variables are available from the special hash variable %ENV
The keys to %ENV are the names of the UNIX environment variables, such as HOME, PATH, PS1, PATH, VISUAL, TERM, et cetera.
You can use one of the values by specifying the key for the hash. Example:

print $ENV{HOME} ;

Sample programs from Clare Nguyen (edited by Ira Oldham)

############## environment variable and include paths ############

Lecture week 11 hour 3 Example environment variable and include paths

#########################

######## environment variable and include paths ###########

foreach (keys %ENV)
{
   print "$_: $ENV{$_}\n";
}

print "@INC\n";