Here is my version, 1145 lines reduced to 208 comments
# if($opt_h) # if($opt_O) # if($opt_O =~ /^connection$|^conn$|^c$/i) # elsif ($opt_O =~ /^operation$|^op$|^o$/i) # elsif ($opt_O =~ /^sort$|^so$/i) # elsif ($opt_O =~ /^statistics$|^statistic$|^stats$|^ +stat$|^st$/i) # elsif ($opt_O =~ /^e|^echo$/i) # else # else # if($opt_S =~ /^(\d+)\/([A-Za-z]+)\/(\d+)\:(\d+):(\d+):(\d+)$/) # elsif ($opt_S =~ /^(\d+):(\d+):(\d+)$/) # else # if($opt_S) # if($opt_E =~ /^(\d+)\/([A-Za-z]+)\/(\d+)\:(\d+):(\d+):(\d+)$/) # elsif ($opt_E =~ /^(\d+):(\d+):(\d+)$/) # else # if($opt_E) # if($opt_S) # if($lower_yr) # if($opt_E) # if($upper_yr) # if($output_format =~ /^connection$|^operation$/) # unless($ARGV[0]) # if($ARGV[1]) # else # elsif ($output_format =~ /^sort$|^echo$|^stat$/) # if($ARGV[0]) # else # if($output_format eq 'operation') # while(<ACCESS_LOG>) # unless($log_line =~ /^\[(\d+)\/([A-Za-z]+)\/(\d+ +)\:(\d+):(\d+):(\d+) ([+|-]\d+)\] conn\=([-]*\d+) op\=([-]*\d+) msgId +\=([-]*\d+) \- (.+)$/) # "next;" # if($opt_S) # unless($lower_epoch) # if($opt_E) # unless($upper_epoch) # if((($opt_S) && ($current_epoch < $lower_epoch)) + || (($opt_E) && ($current_epoch > $upper_epoch))) # "next;" # if(($op_number eq '-1') || ($msgid_number eq '-1 +')) # else # if(($operation_key eq '0:INTERNAL') && ($log_pay +load =~ /connection from/)) # if($opt_v) # foreach(keys(%pending)) # if(($log_payload =~ /^RESULT |^closed\.$|^UNBIND +$|^ABANDON /)) # if(@skipping) # foreach(0..$#skipping) # if($skipping[$i] eq $operation_k +ey) # if($this_is_a_result) # "last;" # if(@printing) # foreach(0..$#printing) # if($printing[$i] eq $operation_k +ey) # if($this_is_a_result) # "last;" # if($this_is_printing) # "next;" # if($skip_this) # "next;" # if(%pending) # if(exists($pending{$operation_key})) # if($opt_v) # if($opt_i) # if($log_line !~ /$filt_expr/i) # else # if($log_line !~ /$filt_expr/) # else # if($opt_i) # if($log_line =~ /$filt_expr/i) # else # if($log_line =~ /$filt_expr/) # if($this_is_a_match) # if($opt_v) # if(($this_is_a_result) && ($this +_is_pending)) # elsif ($this_is_a_result) # else # if($this_is_pending) # else # else # unless($this_is_a_result) # if($this_is_pending) # else # if($opt_v) # unless($this_is_a_result) # if($this_is_pending) # else # if(($this_is_a_result) && ($this +_is_pending)) # elsif ($this_is_pending) # else # if($opt_v) # foreach(keys(%pending)) # if($output_format eq 'connection') # while(<ACCESS_LOG>) # unless($log_line =~ /^\[(\d+)\/([A-Za-z]+)\/(\d+ +)\:(\d+):(\d+):(\d+) ([+|-]\d+)\] conn\=([-]*\d+) op\=([-]*\d+) msgId +\=([-]*\d+) \- (.+)$/) # "next;" # if($opt_S) # unless($lower_epoch) # if($opt_E) # unless($upper_epoch) # if((($opt_S) && ($current_epoch < $lower_epoch)) + || (($opt_E) && ($current_epoch > $upper_epoch))) # "next;" # if(($connection_key eq '0') && ($log_payload =~ +/connection from/)) # if($opt_v) # foreach(keys(%pending)) # if(($op_number eq '-1') && ($msgid_number eq '-1 +') && ($log_payload eq 'closed.')) # if(@skipping) # foreach(0..$#skipping) # if($skipping[$i] eq $connection_ +key) # "last;" # if(@printing) # foreach(0..$#printing) # if($printing[$i] eq $connection_ +key) # if($this_is_a_close) # "last;" # if($this_is_printing) # "next;" # if($skip_this) # "next;" # if(%pending) # if(exists($pending{$connection_key})) # if($opt_v) # if($opt_i) # if($log_line !~ /$filt_expr/i) # else # if($log_line !~ /$filt_expr/) # else # if($opt_i) # if($log_line =~ /$filt_expr/i) # else # if($log_line =~ /$filt_expr/) # if($this_is_a_match) # if($opt_v) # if(($this_is_a_close) && ($this_ +is_pending)) # elsif ($this_is_a_close) # else # if($this_is_pending) # else # else # unless($this_is_a_close) # if($this_is_pending) # else # if($opt_v) # unless($this_is_a_close) # if($this_is_pending) # else # if(($this_is_a_close) && ($this_ +is_pending)) # elsif ($this_is_pending) # else # if($opt_v) # foreach(keys(%pending)) # if($output_format eq 'sort') # while(<ACCESS_LOG>) # unless($log_line =~ /^\[(\d+)\/([A-Za-z]+)\/(\d+ +)\:(\d+):(\d+):(\d+) ([+|-]\d+)\] conn\=([-]*\d+) op\=([-]*\d+) msgId +\=([-]*\d+) \- (.+)$/) # "next;" # if($opt_S) # unless($lower_epoch) # if($opt_E) # unless($upper_epoch) # if((($opt_S) && ($current_epoch < $lower_epoch)) + || (($opt_E) && ($current_epoch > $upper_epoch))) # "next;" # if(($log_payload =~ /connection from/) && ($op_n +umber eq '-1') && ($msgid_number eq '-1')) # elsif (($msgid_number eq '-1') && ($log_payl +oad =~ /closing/)) # elsif (($op_number eq '-1') && ($msgid_numbe +r eq '-1') && ($log_payload eq 'closed.')) # elsif (($op_number eq '-1') || ($msgid_numbe +r eq '-1')) # else # if(($log_payload =~ /^RESULT /)) # if(($this_is_an_open) && ((exists($connections{$ +connection_key})) || ($connection_key eq '0'))) # foreach(@conn_nums) # foreach(@conn_nums) # if($output_format eq 'stat') # while(<ACCESS_LOG>) # unless($log_line =~ /^\[(\d+)\/([A-Za-z]+)\/(\d+ +)\:(\d+):(\d+):(\d+) ([+|-]\d+)\] conn\=([-]*\d+) op\=([-]*\d+) msgId +\=([-]*\d+) \- (.+)$/) # "next;" # if($opt_S) # unless($lower_epoch) # if($opt_E) # unless($upper_epoch) # if((($opt_S) && ($current_epoch < $lower_epoch)) + || (($opt_E) && ($current_epoch > $upper_epoch))) # "next;" # unless($start_epoch) # if($current_epoch > $end_epoch) # if($result_count > 0) # else # if(($log_payload =~ /^RESULT (.+) nentries=(\d+) + etime=(.+?) (.+)$/) || ($log_payload =~ /^RESULT (.+) nentries=(\d+) + etime=(.+?)$/)) # if($3 > $etime_max) # if($4 =~ /notes\=U/) # elsif ($log_payload =~ /^closed\.$/) # elsif ($log_payload =~ /connection from /) # elsif ($log_payload =~ /^ADD /) # elsif ($log_payload =~ /^MOD /) # elsif ($log_payload =~ /^DEL /) # elsif ($log_payload =~ /^SRCH /) # elsif ($log_payload =~ /^BIND /) # elsif ($log_payload =~ /^EXT /) # else # unless($log_payload =~ /^UNBIND$|^ABANDO +N |closing/) # if($result_count > 0) # else # if($output_format eq 'echo') # while(<ACCESS_LOG>) # unless($log_line =~ /^\[(\d+)\/([A-Za-z]+)\/(\d+ +)\:(\d+):(\d+):(\d+) ([+|-]\d+)\] conn\=([-]*\d+) op\=([-]*\d+) msgId +\=([-]*\d+) \- (.+)$/) # "next;" # if($opt_S) # unless($lower_epoch) # if($opt_E) # unless($upper_epoch) # if((($opt_S) && ($current_epoch < $lower_epoch)) + || (($opt_E) && ($current_epoch > $upper_epoch))) # "next;" # if($in_file)

This manual outline generation wouldn't be necessary if the original was skimmable code :)


In reply to Re^2: Main logic of this script (summary/abstract/outline) by Anonymous Monk
in thread Main logic of this script by johnprince1980

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.