Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??
I'm responding again to this idea because your suggestion gained traction with me as I puzzled out a solution. I managed to eliminate the counters, as you suggested, and the code executes more efficiently now. Here's what that portion is now reduced to:
next if ( ($regex1) && ( (($accpyn1) && ($line1 !~ m/$regex1/o)) || (!($accpyn1) && ($line1 =~ m/$regex1/o)) ) ); next if ( ($regex2) && ( (($accpyn2) && ($line2 !~ m/$regex2/o)) || (!($accpyn2) && ($line2 =~ m/$regex2/o)) ) ); next if ( ($regex3) && ( (($accpyn3) && ($line3 !~ m/$regex3/o)) || (!($accpyn3) && ($line3 =~ m/$regex3/o)) ) ); next if ( ($regex4) && ( (($accpyn4) && ($line4 !~ m/$regex4/o)) || (!($accpyn4) && ($line4 =~ m/$regex4/o)) ) );
And with that logic, the counters became unnecessary. So thank you for the suggestion--it has been put to practical use.



In reply to Re^2: Efficient regex search on array table by Polyglot
in thread Efficient regex search on array table by Polyglot

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.