martymart has asked for the wisdom of the Perl Monks concerning the following question:
It's a bit of a mess, with some lines using quotes and others not. I wrote a short script that seems to work fine:$xmldir="c:\test" $cvs="d:\test" %name=lancelot etc.
But, there must be a more efficient way of doing this, possibly using Config::IniFiles or some other code improvements. I'm open to any ideas that my fellow monks could suggest (comments, criticisms, etc.) Thanks in advance.open FILE, "anyfile.ini"||die "file open failed\n"; my %inihash=(); while (my $line = <FILE>) { $line =~ tr/"//d; (my $key, my $value)=split(/=/,$line); $inihash{$key}=$value; }; print "$inihash{'$xmldir'}"; print "$inihash{'$cvs'}"; print "$inihash{'%name'}";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading .ini files
by Mr. Muskrat (Canon) on Nov 25, 2002 at 16:27 UTC | |
|
Re: Reading .ini files
by Wonko the sane (Curate) on Nov 25, 2002 at 16:35 UTC |