If you are looking to change the format, check out the recommendations here:
How do you manage configuration files in Perl?
If you are looking for parsing an existing format, this format looks more like a comma-delimited file than a configuration file, so I would say go to Text :: CSV (it allows you to select the delimiter character in the constructor, so you can separate the colon, not separated by commas) or for very large Text :: CSV_XS files.
use Text::CSV; # Example adapted from POD my @rows; my $csv = Text::CSV->new ( { sep_char => ":" } ) or die "Cannot use CSV: ".Text::CSV->error_diag (); open my $fh, "<:encoding(utf8)", "test.conf" or die "test.conf: $!"; while ( my $row = $csv->getline( $fh ) ) { push @rows, $row; # $row is arrayref containing your fields } $csv->eof or $csv->error_diag(); close $fh;
source share