Hello All, I have copied this script from this url which solves one of my purpose of parsing a config file. Here is the URL http://www.motreja.com/ankur/examplesinperl/parsing_config_files.htm
Now when I am running the script I am getting these errors: Use of uninitialized value in pattern match (m//) at config_parser.pl line 26. Use of uninitialized value in split at config_parser.pl line 27. Use of uninitialized value in hash element at config_parser.pl line 28. Here is the copy of script, may be there is something which I am not doing properly. Could someone please help me running this script successfully. =================================script begins============================ #! perl -w $path_and_filename="data.txt"; # Call the subroutine &parse_config_file ($path_and_filename, \%Config); foreach $Config_key (keys %Config) { print "$Config_key = $Config{$Config_key}\n"; } sub parse_config_file { local ($config_line, $Name, $Value, $Config); ($File, $Config) = @_; if (!open (CONFIG, "$File")) { print "ERROR: Config file not found : $File"; exit(0); } while () { $config_line=$_; #chop ($config_line); # Get rid of the trailling \n if ($config_line !~ /^#/) { # Ignore lines starting with # and blank lines ($Name, $Value) = split (/=/, $config_line); # Split each line into name value pairs $$Config{$Name} = $Value; # Create a hash of the name value pairs } } close(CONFIG); } =================================script ends============================== _______________________________________________ ilugd mailinglist -- ilugd@lists.linux-delhi.org http://frodo.hserus.net/mailman/listinfo/ilugd Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi http://www.mail-archive.com/ilugd@lists.linux-delhi.org/