#File name: ConfigFileRead.pm package ConfigFileRead; use strict; use warnings; my %User_Preferences; my $configFile; print("Printing from ConfigFileRead.pm...\n"); print("\nIn namespace: ",__PACKAGE__,"...\n"); sub readConfigFile { print("Printing from readConfigFile()...\n"); my $configFile=shift; open CONFIG,$configFile || die "Missing input file name.\n"; while () { chomp; # no newline s/#.*//; # no comments s/^\s+//; # no leading white s/\s+$//; # no trailing white next unless length; # anything left? - skip if the the string is not having any length.. if the length of the default string under process is having length greater than 0 then proceed with next step my ($var, $value) = split(/\s*=\s*/, $_, 2); $User_Preferences{$var} = $value; } close(CONFIG); } 1; # don't forget to return a true value from the file #### #Filenname: config.ini # set class C net $NETMASK = '255.255.255.0'; $MTU = 0x128; # Brent, please turn on the modem $DEVICE = 'cua1'; $RATE = 115_200; $MODE = 'adaptive'; #### use strict; use warnings; require ConfigFileRead; &ConfigFileRead::readConfigFile("config.ini"); print("\nIn namespace: ",__PACKAGE__,"...\n"); # How to access the contents of %User_Preferences ? # Need help