<?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: Random Perl Snippet</title>
	<atom:link href="http://www.utahsysadmin.com/2009/04/11/random-perl-snippet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.utahsysadmin.com/2009/04/11/random-perl-snippet/</link>
	<description>Ramblings of a Utah System Administrator</description>
	<lastBuildDate>Fri, 25 Jun 2010 12:50:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Kevin Pendleton</title>
		<link>http://www.utahsysadmin.com/2009/04/11/random-perl-snippet/comment-page-1/#comment-203</link>
		<dc:creator>Kevin Pendleton</dc:creator>
		<pubDate>Mon, 13 Apr 2009 19:42:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.utahsysadmin.com/?p=152#comment-203</guid>
		<description>I did eventually find it in my &quot;Perl 5 Developer&#039;s Guide&quot; called &quot;The Conditional Operator&quot;, which is poorly named since there are multiple conditional operators in Perl.  I did find instances on the web where it is called the tertiary operator in Perl as well.  Anyway, I also learned that it can also handle an &quot;elsif&quot; scenario like this:

&lt;code&gt;$value = ($condition1) ? $value1 : ($condition2) ? $value2 : $value3;&lt;/code&gt;

Kevin</description>
		<content:encoded><![CDATA[<p>I did eventually find it in my &#8220;Perl 5 Developer&#8217;s Guide&#8221; called &#8220;The Conditional Operator&#8221;, which is poorly named since there are multiple conditional operators in Perl.  I did find instances on the web where it is called the tertiary operator in Perl as well.  Anyway, I also learned that it can also handle an &#8220;elsif&#8221; scenario like this:</p>
<p><code>$value = ($condition1) ? $value1 : ($condition2) ? $value2 : $value3;</code></p>
<p>Kevin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Checketts</title>
		<link>http://www.utahsysadmin.com/2009/04/11/random-perl-snippet/comment-page-1/#comment-202</link>
		<dc:creator>Brandon Checketts</dc:creator>
		<pubDate>Mon, 13 Apr 2009 19:22:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.utahsysadmin.com/?p=152#comment-202</guid>
		<description>That is called a &#039;Tertiary&#039; operator, and is basically an operator that takes three arguments.     Think of it as a condensed if..then..else statement.     (condition) ? (true) : (false)

I  use them all the time in PHP to shorten simple conditionals from five lines to one.

&lt;code&gt;if (condition) {
   $value = something
} else {
   $value = something else
}&lt;/code&gt;

Versus

&lt;code&gt;$value = (condition) ? &#039;something&#039; : &#039;something else&#039;;&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>That is called a &#8216;Tertiary&#8217; operator, and is basically an operator that takes three arguments.     Think of it as a condensed if..then..else statement.     (condition) ? (true) : (false)</p>
<p>I  use them all the time in PHP to shorten simple conditionals from five lines to one.</p>
<p><code>if (condition) {<br />
   $value = something<br />
} else {<br />
   $value = something else<br />
}</code></p>
<p>Versus</p>
<p><code>$value = (condition) ? 'something' : 'something else';</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>
