<?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/"
		>
<channel>
	<title>Comments on: Today&#8217;s Perl Lesson</title>
	<atom:link href="http://www.pythian.com/news/6155/todays-perl-lesson/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pythian.com/news/6155/todays-perl-lesson/</link>
	<description>News and views from Pythian DBAs</description>
	<lastBuildDate>Fri, 10 Feb 2012 13:01:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
	<item>
		<title>By: Yanick Champoux</title>
		<link>http://www.pythian.com/news/6155/todays-perl-lesson/#comment-396673</link>
		<dc:creator>Yanick Champoux</dc:creator>
		<pubDate>Tue, 05 Jan 2010 21:07:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=6155#comment-396673</guid>
		<description>...and from there realize that we don&#039;t want a hash, but an array:


my @colours= qw/ red green /;

my $i;
for my $s ( @stuff ) {
..
my $colour=$colours[ $i++ % 2 ];
..
}


And to do without the indexing variable altogether, we can call on darker magic:


my @colours= qw/ red green /;

for my $s ( @stuff ) {
..
my $colour=$colours[ --$&#124; ];
..
}
</description>
		<content:encoded><![CDATA[<p>&#8230;and from there realize that we don&#8217;t want a hash, but an array:</p>
<p>my @colours= qw/ red green /;</p>
<p>my $i;<br />
for my $s ( @stuff ) {<br />
..<br />
my $colour=$colours[ $i++ % 2 ];<br />
..<br />
}</p>
<p>And to do without the indexing variable altogether, we can call on darker magic:</p>
<p>my @colours= qw/ red green /;</p>
<p>for my $s ( @stuff ) {<br />
..<br />
my $colour=$colours[ --$| ];<br />
..<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Romeo Vasileniuc</title>
		<link>http://www.pythian.com/news/6155/todays-perl-lesson/#comment-391241</link>
		<dc:creator>Romeo Vasileniuc</dc:creator>
		<pubDate>Tue, 08 Dec 2009 00:42:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.pythian.com/news/?p=6155#comment-391241</guid>
		<description>You can try this:

my %colours=(1=&gt;&#039;red&#039;, 0=&gt;&#039;green&#039;);

for(my $i=0;$i&lt;@stuff;$i++){
	..
	my $colour=$colours{$i%2};
	..
}</description>
		<content:encoded><![CDATA[<p>You can try this:</p>
<p>my %colours=(1=&gt;&#8217;red&#8217;, 0=&gt;&#8217;green&#8217;);</p>
<p>for(my $i=0;$i&lt;@stuff;$i++){<br />
	..<br />
	my $colour=$colours{$i%2};<br />
	..<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

