I'm not even going to try reading through those regex. Why not make things simpler and do something more like:
use strict; use warnings; my %d; while (<DATA>) { if (m/^Primary \(Reporting\) Cp:/) { ($d{'cp'}) = m/Cp: (\d+)/s; ($d{'set'}) = m/Set: (\d+)/s; ($d{'car'}) = m/Car: (\d+)/s; print "Cp:$d{'cp'} - Set:$d{'set'} - Car:$d{'car'}\n"; } elsif (m/^Missing P:/) { ($d{'keep'}) = m/Keep: (\d+)/s; ($d{'phase'}) = m/Phase: (\w+)/s; ($d{'strength'}) = m/Strength: (\d+)/s; print "Phase:$d{'phase'} - Strength:$d{'strength'}\n"; } elsif (m/Secondary Sector Information:/) { print "Keep:$d{'keep'} - Phase:$d{'phase'} - Strength:$d{'stre +ngth'}\n"; } elsif (m/^Slot/) { ($d{'keep'}) = m/Keep: (\d+)/s; ($d{'offset'}) = m/Offset: (\w+)/s; ($d{'strength'}) = m/Strength: (\d+)/s; print "Keep:$d{'keep'} - Pn_offset:$d{'phase'} - Strength:$d{' +strength'}\n"; } elsif (m/^={68}/) { %d = (); print '-'x30, "\n"; } } print '-'x30, "\n"; __DATA__ ==================================================================== Record: 9851329 Version: 2 Timestamp: Sat Feb 11 22:39:43 2006 Primary (Reporting) Cp: 113 Set: 2 Car: 1 Ref: yes Event: 9922 Missing P: Keep: 1 Phase: 0x2fdf Strength: 24 Secondary Sector Information: ==================================================================== Record: 9851330 Version: 2 Timestamp: Sat Feb 11 22:39:43 2006 Primary (Reporting) Cp: 115 Set: 1 Car: 2 Ref: yes Event: 9923 Missing P: Keep: 1 Phase: 0x7d10 Strength: 31 Secondary Sector Information: Slot 1: Keep: 1 offset: 391 Strength: 27 Ref: no Slot 2: Keep: 1 offset: 325 Strength: 38 Ref: no

In reply to Re: Need help modifying parse program. by TedPride
in thread Need help modifying parse program. by awohld

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.