Can someone help me figure out why this code does not work. A little background first. I program exclusively on Win32 (and sometimes Win9x (eek!!)) and I am writing a program that needs to read in INI file and read each entry into an array. This is necessary because the number of entries is unknown and will be determined by the user. Below is an example program that is supposed to read each entry into an array and then print each entry out to the screen. The problem is that it is not working and I have used this EXACT code in another program and it works perfectly.
use Config::IniFiles;
$cfg = new Config::IniFiles( -file => uc "test.ini", -nocase => 1);
@FileExten = $cfg -> Parameters(FileExten);
foreach $FileExten (@FileExten)
{
$FileExt = uc $cfg -> val(FileExten, $FileExten);
print "$FileExtension is $FileExt\n";
}
CONTENTS OF TEST.INI
[FileExten]
FileExten1 = Value1
FileExten2 = Value2
FileExten3 = Value3
FileExten4 = Value4
FileExten5 = Value5
FileExten6 = Value6
FileExten7 = Value7
FileExten8 = Value8
FileExten9 = Value9
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.