Goes to show that if you plug away the answer will come....
while (<PIL>) { # print ; if (m/\ *object\ \{/) { @lines = $_ ; $objcount++ ; } elsif (m/^\ *\}/) { &Parse_Obj(@lines) ; # print "Found Match!\n" ; } else { push @lines, $_ ; } } sub Parse_Obj { $id = @_[3] ; $origin = @_[1] ; $dims = @_[2] ; $id =~ s/^.*?\"//g ; #remove up to first " $id =~ s/\".*\n$//g ; #remove everything from last " $origin =~ s/^.*?\{\ //g ; #remove up to first { $origin =~ s/\ \}.*\n$//g ; #remove from last } $dims =~ s/^.*?\{\ //g ; #remove up to first { $dims =~ s/\ \}.*\n$//g ; #remove from last } ( $originw, $originh ) = split / /, $origin ; ( $dimsw, $dimsh ) = split / /, $dims ; # print "$objcount : $id $originw $originh $dimsw $dimsh \n" ; if (exists($object{$objcount})) { break } else { $object{"$objcount$;id"} = $id ; $object{"$objcount$;originw"} = $originw ; $object{"$objcount$;originh"} = $originh ; $object{"$objcount$;dimsw"} = $dimsw ; $object{"$objcount$;dimsh"} = $dimsh ; } } # print "join(" ", %object) \n" ; for ($count < $objcount) { print "$object{$count,id} $object{$count,originw} $object{$count,origi +nh} \n" ; }
Thanks for everybody's help. ~Das Ham Man

In reply to Re: Re: Parsing a multiline data structure by HamNRye
in thread Parsing a multiline data structure by HamNRye

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.