in reply to Trying to name a file parsing module for CPAN

You mean putting something like this on to CPAN?

use strict; use Data::Dumper; my @blocks = do { local $/='ID:'; <DATA> }; shift @blocks; my %config; foreach my $line (@blocks) { my ($id) = $line =~ /^(\w+)/; my %keys = $line =~ /^(\w+):(\w+)/gms; $config{$id} = \%keys; } print Dumper(\%config); __DATA__ HEADER1:value HEADER2:value ID:id1 KEY1:A KEY2:B KEY3:C ID:id2 KEY3:E KEY2:F ID:id3 KEY5:G __OUTPUT__ $VAR1 = { 'id1' => { 'KEY3' => 'C', 'KEY1' => 'A', 'KEY2' => 'B' }, 'id2' => { 'KEY3' => 'E', 'KEY2' => 'F' }, 'id3' => { 'KEY5' => 'G' } };

Replies are listed 'Best First'.
Re: Re: Trying to name a file parsing module for CPAN
by fx (Pilgrim) on Jan 09, 2004 at 10:17 UTC

    You mean putting something like this on to CPAN?

    No, I don't.

    I did say in my original post that I wasn't asking for solutions, and that in the context of the question what was returned did not matter.

    My module allows you to specify which of the keys you want returned, which keys are mandatory, whether keys can be repeated for a single ID, what headers key:value pairs are present, what footer pairs, etc.

    It's not as simple as the example I gave - that is why it was an example.

    My question was aimed at trying to find a name for that style of file. I believe that the files I have are being generated from some db running on some kind of mainframe system. Maybe this format is seen frequently in the mainframe world - I don't know - and so I thought I would throw the question to the world.

    Thanks.