Hi, If i understood your question correctly the following will help you.

use strict; use warnings; local $/= "\n="; while (my $line = <DATA>) { print "\n------------------------------\n"; if ($line =~ m/Primary \(Reporting\) ID\s*:\s*((?:(?!Level).)*)Level\s +*:\s*((?:(?!Group).)*)Group\s*:\s*((?:(?!Reg).)*)/si) { print "Primary (Reporting) ID : $1\nLevel : $2\nGroup : $3"; } if ($line =~ m/ID-Node\s*:\s*((?:(?!Inverse).)*)Inverse\s*:\s*((?:(?!\ +n).)*)/si) { print "\nID-Node : $1\nInverse : $2\n"; } print "\nSecondary ID :"; while ($line =~ m/(?<!Primary \(Reporting\) )(?<!Secondary )ID\s*:\s*( +(?:(?!Inverse).)*)Inverse\s*:\s*((?:(?!\n).)*)/gsi) { print "\nID : $1\tInverse : $2"; } print "\n------------------------------\n"; } __DATA__ ====================================================================== Record: 9868943 Version: 2 Timestamp: Sat Feb 18 22:33:43 2006 Primary (Reporting) ID: 240 Level: 2 Group: 1 Reg: no Event: 51748 Keep: 1 ID-Node: 0x2017 Inverse: 25 Secondary ID: Keep: 1 ID: 68 Inverse: 23 Keep: 1 ID: 240 Inverse: 27 Keep: 1 ID: 368 Inverse: 30 ====================================================================== Record: 9868944 Version: 2 Timestamp: Sat Feb 18 22:33:44 2006 Primary (Reporting) ID: 67 Level: 9 Group: 0 Reg: no Event: 51749 Keep: 1 ID-Node: 0xA087 Inverse: 55 Secondary ID: Keep: 1 ID: 62 Inverse: 73 Output is : ------------------------------ Primary (Reporting) ID : 240 Level : 2 Group : 1 ID-Node : 0x2017 Inverse : 25 Secondary ID : ID : 68 Inverse : 23 ID : 240 Inverse : 27 ID : 368 Inverse : 30 ------------------------------ ------------------------------ Primary (Reporting) ID : 67 Level : 9 Group : 0 ID-Node : 0xA087 Inverse : 55 Secondary ID : ID : 62 Inverse : 73 ------------------------------

Regards,
Velusamy R.


eval"print uc\"\\c$_\""for split'','j)@,/6%@0%2,`e@3!-9v2)/@|6%,53!-9@2~j';


In reply to Re: Need Record Parsing Advice by Samy_rio
in thread Need Record Parsing Advice 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.