Untested, but try something like:
my $vals;
open (READIT, "./filename.cfg") || die "Cant read filename.cfg. Reason: $!";
while (<READIT>) {
if ($_ =~ /^#/ || $_ =~ /^\s+/) { next; }
if ($_ =~ /\[(.*)\]/) {
$section = $1;
} else {
my ($col,$value) = split /=/, $_;
$vals->{$section}->{$col} = $value;
}
}
close (READIT);
..then call with something like:
Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Code:
my $section; my $vals;
open (READIT, "./filename.cfg") || die "Cant read filename.cfg. Reason: $!";
while (<READIT>) {
if ($_ =~ /^#/ || $_ =~ /^\s+/) { next; }
if ($_ =~ /\[(.*)\]/) {
$section = $1;
} else {
my ($col,$value) = split /=/, $_;
$vals->{$section}->{$col} = $value;
}
}
close (READIT);
..then call with something like:
Code:
$vals->{'MACHINE NAME'}->{"A"}Cheers
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!