What's the while inside while code you tried? (we can advise if it's minor to fix or a compare it to other solutions.)

As for other solutions, the first question i think is if you can slurp in the whole log file or not. Assuming you can't due to size, you were on the right track with a while loop... perhaps something like:
while(my $s1 = <LOG>){ next unless $s1 =~ m#^(\d+/\d+/\d+) (\d+:\d+:\d+) user=(\S+) func\(# +; my ($date, $time, $user) = ($1, $2, $3); ... # above variables are available while(my $s2 = <LOG>){ last if $s2 =~ /^\) #end trans#/; ... # $s2 is log data } }
Note you could do this w/a single while loop (as opposed to nested ones) if you used a boolean or two to keep track of being inside a log data section or not..

Update: I like the above solution of $/ = '#end trans#' -- my original thought was to split() on the start line, but that would required the whole log in memory, so i switched back to the while/while method.. hopefully it will at least serve as a guide is debugging your while loop attempt.

In reply to Re: Fetch data between markers by davidrw
in thread Fetch data between markers by penantes

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.