Since your file appears to be line-oriented and each line has the same simple syntax, you can write a simple parser that converts this output into a perl data structure:

my $root = {}; my $node = $root; my @stack; while (<DATA>) { chomp; if (/^\s*BEGIN\s+(.*)/) { my $child = {}; $child->{_type} = $1; push(@{$node->{_children}}, $child); push(@stack, $node); $node = $child; } elsif (/^\s*END\s+(.*)/) { # check: $node->{_type} eq $1 $node = pop(@stack); } elsif (/^\s*(\S+)\s+(.*)/) { # remove quotes from $2 here? $node->{$1} = $2; } else { die "unexpected input: $_" } } use Data::Dumper; print Dumper($root);
And on your sample input this produces:
$VAR1 = { '_children' => [ { 'NLSLocale' => '",,,,"', 'JobVersion' => '"50.0.0"', 'MetaBag' => '"CMetaProperty"', 'OLEType' => '"CJobDefn"', 'Container' => '"V0"', 'NULLIndicatorPosition' => '"0"', '_type' => 'DSRECORD', '_children' => [ { 'Prompt' => '"/home/mi +gration/Dev root "', 'Default' => '"/home/m +igration/Dev"', 'ParamScale' => '"0"', 'ParamLength' => '"0"' +, '_type' => 'DSSUBRECOR +D', 'ParamType' => '"0"', 'Name' => '"ROOT"' }, { 'Prompt' => '"Business + Unit, ie WHUB"', 'Default' => '"CDBS"', 'ParamScale' => '"0"', 'ParamLength' => '"0"' +, '_type' => 'DSSUBRECOR +D', 'ParamType' => '"0"', 'Name' => '"SITE"' }, { 'Prompt' => '"Area of +Work ie AP"', 'Default' => '"AP"', 'ParamScale' => '"0"', 'ParamLength' => '"0"' +, '_type' => 'DSSUBRECOR +D', 'ParamType' => '"0"', 'Name' => '"AOW"' }, { 'Prompt' => '"DMR/Spec + ie Vendors"', 'Default' => '"Vendors +"', 'ParamScale' => '"0"', 'ParamLength' => '"0"' +, '_type' => 'DSSUBRECOR +D', 'ParamType' => '"0"', 'Name' => '"DMR"' }, { 'Owner' => '"APT"', 'Value' => '"#DSProjec +tARTOptions#"', '_type' => 'DSSUBRECOR +D', 'Name' => '"AdvancedRu +ntimeOptions"' } ], 'Readonly' => '"0"', 'NextID' => '"194"', 'ControlAfterSubr' => '"0"', 'TimeModified' => '"00.00.01"', 'CenturyBreakYear' => '"30"', 'Parameters' => '"CParameters"', 'JobType' => '"0"', 'DateModified' => '"1899-12-30"', 'Identifier' => '"ROOT"', 'FullDescription' => '"The first part of +the routine gathers data from the ABAP which extracts the necessary d +ata from the SAP tables KNA1 and KNB1 (NB the keys of the link betwee +n KNA1 and KNB1 will form the basis of all the ABAP queries)."', 'Description' => '"Collates all of the da +ta for the customer master migration."', 'Name' => '"AP_CDBS_Vendor_Summary"', 'Category' => '"1.FSS\\\\2.AP\\\\6.CDBS\\ +\\1.Vendors\\\\3.Reports"', 'IsTemplate' => '"0"' } ] };

In reply to Re: Design hints for a file processor by pc88mxer
in thread Design hints for a file processor by PhilHibbs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.