<br><br><div class="gmail_quote">On Wed, Jun 24, 2009 at 5:35 PM, Ryan Corder <span dir="ltr">&lt;<a href="mailto:ryanc@greengrey.org">ryanc@greengrey.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Wed, Jun 24, 2009 at 05:25:08PM -0700, John W. Krahn wrote:<br>
&gt; $ perl -le&#39;<br>
&gt; my $code = &lt;&lt;__CODE__;<br>
&gt;  :    sub hello {<br>
&gt;  :        say &quot;Hello World!&quot;;<br>
&gt;  :    }<br>
&gt; __CODE__<br>
&gt;<br>
&gt; ( $code = &quot;[code]$code\[/code]&quot; ) =~ s/ +://g;<br>
&gt;<br>
&gt; print $code;<br>
&gt; &#39;<br>
&gt; [code]    sub hello {<br>
&gt;         say &quot;Hello World!&quot;;<br>
&gt;     }<br>
&gt; [/code]<br>
<br>
</div>&gt;&gt;After I sent my initial email, I had a feeling that your &gt;&gt;answer would be the first one back and that is </blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
 &gt;&gt; entirely my fault.  I should have specified that </blockquote><div>   &gt;&gt;  $code would most likely contain lines<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

&gt;&gt; of text before and after the lines that begin with &#39;:&#39;.  &gt;&gt;So, I can&#39;t just wrap $code with [code] tags and then &gt;&gt; do a simple substitute on it.<br></blockquote><div> </div><br>Er, wouldn&#39;t this work even with the added qualification:<br>
<br>$code = &quot;[code]${code}[\\code]&quot;;  <br>$code =~ s/^ ://gm;        <br>                  <br>-- <br>Charles DeRykus<br></div><br>