in reply to Parsing multiple values in a singe line

Assuming that you've read the file into $data, the following should work (untested):
my @lines = grep(defined, split(/.{80}/, $data)); my %data; foreach (@lines) { last if(/^END /); if(/^([^\s]+)\s*=\s*(.*?)\s*$/) { $data{$1} = $2; } }
That will get everything to the right of the = into the %data hash. You may need to process this data further (such as removing what look like /comments as well as dealing with the quotes.

Replies are listed 'Best First'.
(tye)Re: Parsing multiple values in a singe line
by tye (Sage) on Apr 06, 2001 at 00:06 UTC

    split(/.{80}/, $data)

    Actually, that would store one empty field, throw out the first 80 characters of $data as the first delimiter, store a second empty field, throw away the next 80 characters of $data as the second delimiter, store a third empty field, etc. Finally it would return int(length($data)/80) empty fields followed by the last length($data)%80 characters of $data. Not very useful.

    If you update it to: grep(defined, split(/(.{80})/, $data)) then it would at least return the "delimiters" (which are really the data you want). But empty fields are "" not undef so the grep above is pointless.

    So change that first line to: my @lines = grep(length, split(/(.{80})/, $data)); and you should be close.

            - tye (but my friends call me "Tye")