You asked a similar question before and we gave you the answer to this question Can't read files content I am not sure if you read the post, but the regex is all you have to change if you want to "extract". Now, when you say "extract" usually that means that you want to store that data as a variable, or create a structure. But, it really looks like you just want to change some input data and reformat it for output. The easiest way to do that is to read it a line at a time, and do a substitution like so:
use strict; while(<DATA>){ ~s/></>FREE</ if /Required Bearer Cap/; ~s/></>FREE</ if /Info Recei frm/; ~s/>FREE</>PRICELESS</ if /Perl Monks Help/; print; } __DATA__ LSB Length : 76 [4c] Version : >04< [04] Record length : 0 [00] Record Type : '1' [01] Efficiency Indicator : '0' Successful Term Type : '0' [00] Unefficiency Cause : 'f' Resource Alloc Ind : 'f' [ff] Term Origin : 'f' Term Indicator : 'f' [ff] Info Teleservice : 33 [21] Required Bearer Service : 255 [ff] Time Stamp 1 : >030720215113< [03 07 20 21 51 13] Country Code : 1 [00 00 01] Time Stamp 2 : >030720215113< [07 20 21 51 13] Input Info : >5341870393005150< [53 41 87 03 93 00 5 +1 50] List Of Invoked Supp Ser : >< List Information : >1960136771453< [91 06 31 76 17 54 f3] Price ID : >502130101789872< [05 12 03 01 71 98 78 + f2] Price Code : >910631420033f9< [91 06 31 42 00 33 f9] Discount Identity : >1960132400000< [91 06 31 42 00 00 f0] FOC Identity : >0085 3217< [05 f2 31 00 85 32 17] extension : >< Required Bearer Capability : >< Info Recei frm Fixed Supp : >< Hotdog at the park : >$5.00< Perl Monks Help : >FREE<


JamesNC

In reply to Re: Read and captured selected input data ? by JamesNC
in thread Read and captured selected input data ? by bh_perl

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.