I have this code in my program and it's parsing a large log file. When it reaches at this point the regular expression seems to hang badly, there is a faster way to process the code to improve speed? Here is the code:
my $p1= "iapw_p1"; my $p2= "iapw_p2"; my $p3= "iapw_p3"; my $b1= "iapw_b1"; my $p0= "iapw_p0"; my $c0= "iapw_c0"; my $c1= "iapw_c1"; my $c3= "iapw_c3"; my $h1= "iapw_h1"; my $p1b="<font color=\"navy\" size=\"2\"><b>P1</b></font><font color=\ +"#000000\" size=\"2\"><b><i> = (file inquiry - launch page)</i></b></ +font>"; my $p2b="<font color=\"navy\" size=\"2\"><b>P2</b><font color=\"#00000 +0\" size=\"2\"><b><i> = (file search - replace - operators)</i></b></ +font>"; my $p3b="<font color=\"navy\" size=\"2\"><b>P3</b><font color=\"#00000 +0\" size=\"2\"><b><i> = (file notepad)</i></b></font>"; my $b1b="<font color=\"navy\" size=\"2\"><b>B1</b><font color=\"#00000 +0\" size=\"2\"><b><i> = (file inquiry: old - owners and preowners)</i +></b></font>"; my $p0b="<font color=\"navy\" size=\"2\"><b>P0</b><font color=\"#00000 +0\" size=\"2\"><b><i> = (file search)</i></b></font>"; my $c0b="<font color=\"navy\" size=\"2\"><b>C0</b><font color=\"#00000 +0\"e size=\"2\"><b><i> = (file search)</i></b></font>"; my $c1b="<font color=\"navy\" size=\"2\"><b>C1</b><font color=\"#00000 +0\" size=\"2\"><b><i> = (file inquiry)</i></b></font>"; my $c3b="<font color=\"navy\" size=\"2\"><b>C3</b><font color=\"#00000 +0\" size=\"2\"><b><i> = (file notepad)</i></b></font>"; my $h1b="<font color=\"navy\" size=\"2\"><b>H1</b><font color=\"#00000 +0\" size=\"2\"><b><i> = (file and arch inquiry and history)</i></b></ +font>"; for (@a_data) { s/$p1/$p1b/; s/$p2/$p2b/; s/$p3/$p3b/; s/$b1/$b1b/; s/$p0/$p0b/; s/$c0/$c0b/; s/$c1/$c1b/; s/$c3/$c3b/; s/$h1/$h1b/; }

edited: Wed Aug 14 15:08:05 2002 by jeffa - title change (was: Regular Expression)


In reply to Regex on log file hangs by Anonymous Monk

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.