Jim Hansen wrote:
> sorry, meant to throw a Subject in there....
> 
> */Jim Hansen <[EMAIL PROTECTED]>/* wrote:
> 
>         I have an INI file with data in it like:
> 
>         [Servers]
> 
>         List1 = "server01 server02 server03 server04"
> 
>         List2 = .....
> 
>         Unfortunately, this line "my @Server = $List{$iniList};" ends up
>         with the contents of List1.  Is split the only way to pull these
>         oout?

Try something more like :

use strict;
use warnings;
use Win32;
use Win32::AdminMisc;

my $inifile = './servers.ini';

if (! -f $inifile) {

        my $value = Win32::MsgBox(
          'The file Uptime.ini could not be located.  Make sure is is in the ' .
          'same directory as Uptime.exe', 64, 'File not found error!');

        # actually it needs to be in whatever directory is current

        exit 2; # error exit ENOENT (2) - No such file or directory
}

# Read sections from INI File

my @Sections = Win32::AdminMisc::ReadINI($inifile, '', '');

my %List;

# do foreach section

foreach my $section (@Sections) {

        # get keys in section

        my @keys = Win32::AdminMisc::ReadINI($inifile, $section, '');

        # do foreach key in section

        foreach my $key (@keys) {

                # get key value

                my $val = Win32::AdminMisc::ReadINI($inifile, $section, $key);

                $List{$key} = $val;     # not needed anywhere here, but maybe
                                        # elsewhere

                foreach my $server (split ' ', $val) {
                        # server code here
                }
        }
}

__END__



-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to