All pastes #36575 Raw Edit

xorc

public text v1 · immutable
#36575 ·published 2006-01-12 10:52 UTC
rendered paste body
#!/usr/bin/perl

sub parseconfig {
        ($file) = @_;
        open (CONFIG,$file) unless (-z $file);

        while ($config = <CONFIG>) {
                chomp $config;
                ($key, $valueCon) = split(':',$config);

                print "Key: $key\n";
                print "Values:";
                @valueArr = split(/ /,$valueCon);
                foreach(@valueArr) {
                        print "$_\n";
                }

        }
        close(CONFIG);
}
parseconfig('bla.conf');