<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Replacing sed</title>
	<atom:link href="http://curiousprogrammer.wordpress.com/2011/02/28/replacing-sed/feed/" rel="self" type="application/rss+xml" />
	<link>http://curiousprogrammer.wordpress.com/2011/02/28/replacing-sed/</link>
	<description>Leveraging Perl and Emacs</description>
	<lastBuildDate>Tue, 07 May 2013 11:25:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Jared</title>
		<link>http://curiousprogrammer.wordpress.com/2011/02/28/replacing-sed/#comment-8856</link>
		<dc:creator><![CDATA[Jared]]></dc:creator>
		<pubDate>Mon, 28 Feb 2011 22:27:59 +0000</pubDate>
		<guid isPermaLink="false">http://curiousprogrammer.wordpress.com/?p=1501#comment-8856</guid>
		<description><![CDATA[Hi folks,

Sorry about the WordPress code mangling feature.  If it makes it any better, it annoys the heck out of me too.

@Mark - neat golfing, and definitely better than my initial attempt :)  I&#039;m aiming for clearer rather than terser code (although terse is still important to compete with sed).  Not sure if I got it.

@Sue -

I&#039;ve tried to add back the missing angle-brackets.  Let me know if I&#039;ve missed any.

Ah yes, $var &#124;&#124;= 0 is a reflex to avoid undefined warnings when I have warnings turned on.

And I definitely like the way you&#039;re going with &lt;code&gt;S&lt;/code&gt;.  My thinking was that sometimes the very next lines aren&#039;t the interesting ones.  Maybe you want the 2nd and 3rd lines following a particular match.  It could be that doesn&#039;t happen much in practice mind you.]]></description>
		<content:encoded><![CDATA[<p>Hi folks,</p>
<p>Sorry about the WordPress code mangling feature.  If it makes it any better, it annoys the heck out of me too.</p>
<p>@Mark &#8211; neat golfing, and definitely better than my initial attempt <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   I&#8217;m aiming for clearer rather than terser code (although terse is still important to compete with sed).  Not sure if I got it.</p>
<p>@Sue -</p>
<p>I&#8217;ve tried to add back the missing angle-brackets.  Let me know if I&#8217;ve missed any.</p>
<p>Ah yes, $var ||= 0 is a reflex to avoid undefined warnings when I have warnings turned on.</p>
<p>And I definitely like the way you&#8217;re going with <code>S</code>.  My thinking was that sometimes the very next lines aren&#8217;t the interesting ones.  Maybe you want the 2nd and 3rd lines following a particular match.  It could be that doesn&#8217;t happen much in practice mind you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sue D. Nymme</title>
		<link>http://curiousprogrammer.wordpress.com/2011/02/28/replacing-sed/#comment-8854</link>
		<dc:creator><![CDATA[Sue D. Nymme]]></dc:creator>
		<pubDate>Mon, 28 Feb 2011 14:31:26 +0000</pubDate>
		<guid isPermaLink="false">http://curiousprogrammer.wordpress.com/?p=1501#comment-8854</guid>
		<description><![CDATA[Crud.  And the second line of the &lt;code&gt;while&lt;/code&gt; block in the above function was supposed to be &lt;code&gt;$_&#160;=&#160;&lt;&gt;&lt;/code&gt;.

Ah, HTML....]]></description>
		<content:encoded><![CDATA[<p>Crud.  And the second line of the <code>while</code> block in the above function was supposed to be <code>$_&nbsp;=&nbsp;&lt;&gt;</code>.</p>
<p>Ah, HTML&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sue D. Nymme</title>
		<link>http://curiousprogrammer.wordpress.com/2011/02/28/replacing-sed/#comment-8853</link>
		<dc:creator><![CDATA[Sue D. Nymme]]></dc:creator>
		<pubDate>Mon, 28 Feb 2011 14:29:43 +0000</pubDate>
		<guid isPermaLink="false">http://curiousprogrammer.wordpress.com/?p=1501#comment-8853</guid>
		<description><![CDATA[&lt;em&gt;Hmmm, blank lines seem to screw up &lt;code&gt; formatting.  Here&#039;s another try.&lt;/em&gt;

&lt;code&gt;$lines &#124;&#124;= 0;&lt;/code&gt; serves no point, since the very next thing you do with $lines is check it for falsehood.

How about:
&lt;code&gt;
    package S;  # for &quot;Sed&quot;
    use base &#039;Exporter&#039;;
    our @EXPORT = (&#039;p&#039;);
    sub p  # print ARG lines from stdin, starting with current
    {
        my $nlines = shift &#124;&#124; return;
        while (--$nlines) { print; $_ = &lt;&gt; ; }
        print;
    }
&lt;/code&gt;
Then at the command line:
&lt;code&gt;
    perl -MS -n &#039;/somefunc()/ &amp;&amp; p(3)&#039;
&lt;/code&gt;]]></description>
		<content:encoded><![CDATA[<p><em>Hmmm, blank lines seem to screw up &lt;code&gt; formatting.  Here&#8217;s another try.</em></p>
<p><code>$lines ||= 0;</code> serves no point, since the very next thing you do with $lines is check it for falsehood.</p>
<p>How about:<br />
<code><br />
    package S;  # for "Sed"<br />
    use base 'Exporter';<br />
    our @EXPORT = ('p');<br />
    sub p  # print ARG lines from stdin, starting with current<br />
    {<br />
        my $nlines = shift || return;<br />
        while (--$nlines) { print; $_ = &lt;&gt; ; }<br />
        print;<br />
    }<br />
</code><br />
Then at the command line:<br />
<code><br />
    perl -MS -n '/somefunc()/ &amp;&amp; p(3)'<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sue D. Nymme</title>
		<link>http://curiousprogrammer.wordpress.com/2011/02/28/replacing-sed/#comment-8852</link>
		<dc:creator><![CDATA[Sue D. Nymme]]></dc:creator>
		<pubDate>Mon, 28 Feb 2011 14:28:21 +0000</pubDate>
		<guid isPermaLink="false">http://curiousprogrammer.wordpress.com/?p=1501#comment-8852</guid>
		<description><![CDATA[&lt;code&gt;$lines &#124;&#124;= 0;&lt;/code&gt; serves no point, since the very next thing you do with $lines is check it for falsehood.

How about:
&lt;code&gt;
    package S;  # for &quot;Sed&quot;
    use base &#039;Exporter&#039;;
    our @EXPORT = (&#039;p&#039;);

    sub p  # print ARG lines from stdin, starting with current
    {
        my $nlines = shift &#124;&#124; return;
        while (--$nlines) { print; $_ = ; }
        print;
    }
&lt;/code&gt;
Then at the command line:
&lt;code&gt;
    perl -MS -n &#039;/somefunc()/ &amp;&amp; p(3)&#039;
&lt;/code&gt;]]></description>
		<content:encoded><![CDATA[<p><code>$lines ||= 0;</code> serves no point, since the very next thing you do with $lines is check it for falsehood.</p>
<p>How about:<br />
<code><br />
    package S;  # for "Sed"<br />
    use base 'Exporter';<br />
    our @EXPORT = ('p');</p>
<p>    sub p  # print ARG lines from stdin, starting with current<br />
    {<br />
        my $nlines = shift || return;<br />
        while (--$nlines) { print; $_ = ; }<br />
        print;<br />
    }<br />
</code><br />
Then at the command line:<br />
<code><br />
    perl -MS -n '/somefunc()/ &amp;&amp; p(3)'<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Fowler</title>
		<link>http://curiousprogrammer.wordpress.com/2011/02/28/replacing-sed/#comment-8851</link>
		<dc:creator><![CDATA[Mark Fowler]]></dc:creator>
		<pubDate>Mon, 28 Feb 2011 08:44:52 +0000</pubDate>
		<guid isPermaLink="false">http://curiousprogrammer.wordpress.com/?p=1501#comment-8851</guid>
		<description><![CDATA[What I was trying to say in my previous comment (before wordpress &quot;smartened&quot; my code) was:

https://gist.github.com/847093]]></description>
		<content:encoded><![CDATA[<p>What I was trying to say in my previous comment (before wordpress &#8220;smartened&#8221; my code) was:</p>
<p><a href="https://gist.github.com/847093" rel="nofollow">https://gist.github.com/847093</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Fowler</title>
		<link>http://curiousprogrammer.wordpress.com/2011/02/28/replacing-sed/#comment-8850</link>
		<dc:creator><![CDATA[Mark Fowler]]></dc:creator>
		<pubDate>Mon, 28 Feb 2011 08:38:28 +0000</pubDate>
		<guid isPermaLink="false">http://curiousprogrammer.wordpress.com/?p=1501#comment-8850</guid>
		<description><![CDATA[perl -ne &#039;print if $a-- &#124;&#124; ($a=/fsomefunc\(\)/*2)&#039;]]></description>
		<content:encoded><![CDATA[<p>perl -ne &#8216;print if $a&#8211; || ($a=/fsomefunc\(\)/*2)&#8217;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
