Fellow monks, I come in seek of knowledge..
The following is a snippet of code from a script I wrote a while back that grabs info from Arcserve summary logs. I'm very self consious about the code I write and was wondering if this is morally ok? This part just gathers all info between the first occurance of the date and the last line of the file.
Does this meet Monk specification?
my @input = <LOG>; my $counter = 0; my $start_time; # this finds the date we are looking for # and stores its array location # sample of the lines we are looking at -> # 20020111 164741 892 26,212 Directories 52,846 Files (805.49 MB) +Backed Up to Media. foreach $_ (@input) { $counter++; if (/$date/) { $start_time = $counter; last; } } # last line my $end = $#input; # if log file is blank if ($start_time eq 0) { $start_time = $end; } # print summary to another log foreach $_ (@input[$start_time..$end]) { print LOGFILE "$_"; }
--JD

In reply to Monk Specs.? by draper7

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.