This would be a far better question -- i.e., one that would be easier for us to help you with -- had you included some explanation of what's going wrong -- error messages; erroneous output (that is, output other than what you expected and wanted); computer begins to smoke; etc.

My guess, however, is that perhaps you saw something like this (where <t>nn is perhaps 14, 15, or 16, depending on what your header (hashbang, strict, warnings, etc) contains.):

Use of uninitialized value within %dic in substitution iterator at 110 +0671.pl line nn, <F> line 3. Use of uninitialized value within %dic in substitution iterator at 110 +0671.pl line nn, <F> line 3.

If so, Perl is basicly telling you it ran out of input at line 3 of your input file... which makes a lot of sense since your sample shows only two lines in the input file.

An ordinary way to deal with this is to read from F in a WHILE construct; other would be to test the read result for content (ie, len != 0 or similar).

UPDATE: PS: put code tags around data, as well as around code.


++$anecdote ne $data



In reply to Re: Multiline Regex replacement in Multiline file by ww
in thread Multiline Regex replacement in Multiline file by akamboj84

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.