Of course,you don't show any representative data, but if you're reading data in  $/ = ""; paragraph or paragrep (another search term) mode, it's likely there are one or more embedded newlines in the strings you're getting from input. Then you should be aware that the regex metacharacter/operator  ^ (carat) behaves differently according to the  /m regex modifier (and likewise $). See  ^ (and $) and  /m in perlre and perlretut.

c:\@Work\Perl\monks>perl -wMstrict -le "my $s = qq{foo fee fie\nbar bell\nbaz biz boz}; print qq{[[$s]]}; print '--------'; ;; my ($x) = $s =~ m{ ^ foo (.+) }x; my ($y) = $s =~ m{ ^ bar (.+) }x; my ($z) = $s =~ m{ ^ baz (.+) }x; print qq{'$x' '$y' '$z'}; print '--------'; ;; ($x) = $s =~ m{ ^ foo (.+) }xm; ($y) = $s =~ m{ ^ bar (.+) }xm; ($z) = $s =~ m{ ^ baz (.+) }xm; print qq{'$x' '$y' '$z'}; " [[foo fee fie bar bell baz biz boz]] -------- Use of uninitialized value $y in concatenation (.) or string at -e lin +e 1. Use of uninitialized value $z in concatenation (.) or string at -e lin +e 1. ' fee fie' '' '' -------- ' fee fie' ' bell' ' biz boz'


In reply to Re: read file a paragraph at a time and return paragraph OR get specific data from paragraph by AnomalousMonk
in thread read file a paragraph at a time and return paragraph OR get specific data from paragraph by james28909

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.