Hi all,<br><br>I&#39;m going through logs seeing if a change improved a particular SQL statements execution time. The part I&#39;m interested looks like this:<br><br>  insert into foo..bar_440_5678_D<br>  select<br>        a.pd,<br>

        <a href="http://a.tg">a.tg</a>,<br>  ....<br>  Elapsed time: 0m27.485s<br><br>I&#39;m interested in the &quot;5678&quot; and the time it took. Seems like the flip-flip &quot;..&quot; is perfect for a quick hack to extract that info:<br>

<br>perl -ne &#39;if(/insert into foo\.\.bar_440_(\d+)/../time: (.+)/&amp;&amp;$1){print &quot;$1\n&quot;}&#39; SQL.log<br><br>The thing is, it prints &quot;5678&quot; many times, until it gets to the &quot;Elapsed time&quot; portion. I would expect that the lines between the start and the end, which don&#39;t match, to clear $1.<br>

<br>I ended up with a longer one-liner to extract the info I was looking for-<br><br>perl -ne &#39;if(((/insert into foo\.\.bar_440_(\d+)/ and $a=$1)..(/time: (.+)/ and $b=$1))&amp;&amp;$b){print &quot;$a took $b\n&quot;;$b=0}&#39; SQL.log<br>

<br>Now I&#39;m curious why I couldn&#39;t rely on $1 being undefined for the intermediate lines. Anyone have a good explanation?<br><br>-y<br><br><br>