# First, open a lexical block to hold the configuration variables. { # Now, open a configuration file to pull in data. my %settings; open my $config, " ) { my ( $key, $value ) = split /\s+=\s+/, $entry; chomp $value; $settings{$key} = $value; } close $config; # Now, define the sub that will be the "getter" of # the lexical variables. sub mysub { print "Configuration file settings:\n"; foreach my $key ( %settings ) { print "$key = $settings{$key}\n"; } } # Next, close the lexical block. Only things within this block # will have access to the varibles declared with 'my' within it. } # This is the main program block: mysub();