<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Revolves &#187; Perl</title>
	<atom:link href="http://www.revolves.net/category/programming/perl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.revolves.net</link>
	<description>Innovation</description>
	<lastBuildDate>Wed, 05 May 2010 14:30:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Perl Ends Language Wars</title>
		<link>http://www.revolves.net/2010/01/17/perl-ends-language-wars/</link>
		<comments>http://www.revolves.net/2010/01/17/perl-ends-language-wars/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 05:34:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.revolves.net/?p=277</guid>
		<description><![CDATA[There is more than one way to do it. However, there is one and only one way that gets the job done better than all others. Damn. Has Python won? There are many ways to solve a problem. We share our own views in online communities, learn new methods and use the one that suits [...]]]></description>
			<content:encoded><![CDATA[<p><strong>There is more than one way to do it.</strong> However, there is one and only one way that gets the job done better than all others. Damn. Has Python won?</p>
<p>There are many ways to solve a problem. We share our own views in online communities, learn new methods and use the one that suits us the most.<br />
<span id="more-277"></span><br />
Let&#8217;s take sorting. For a given type of data, a specific algorithm may be the fastest. So, it&#8217;s great from performance point of view.</p>
<p>But we&#8217;re coming out of &#8220;performance&#8221; and into &#8220;maintainability.&#8221; There could be several ways of solving a problem wherein the peformance difference is neglible considering your use of the software. In that case, you select the method that suits you the most.</p>
<p>An example of this is variable, function or class naming convention. Two people might choose entirely different names for varibles, methods or classes while writing the exact same program. Maybe they even choose a different way of expressing certain aspects of the program. Or, they might even choose two different programming languages!</p>
<p>Considering the performance of several methods equivalent, or the trade-offs between performance and maintainability acceptable, each individual choose the one that he is most comfortable with. See? There is more than one way to do it!</p>
<p>Now, I&#8217;m really going to talk something weird, so pay attention. The <strong>best</strong> method not only depends on pure performance or the problem, but also on your skills, your environment, your colleagues, your company and much more.</p>
<p>In a nutshell, even though a problem might have only <strong>one best solution</strong>, but that best solution <strong>need not be same for everyone!</strong> The best one depends on human factors too, which is different from person to person.</p>
<p>When a wise Perl Monk says, &#8220;There is more than one way to do it&#8221;, he doesn&#8217;t mind whether you programmed your solution in Python, Perl, Ruby or any new language that drops down from the sky. He would just say, &#8220;You found one of the several ways to do it.&#8221;</p>
<p>Here, we look at Perl&#8217;s idiom at a much broader scope. Instead of confining it to Perl, we&#8217;ve expanded it to programming in general. You could expand it to life in general.</p>
<p>There are a lot of things that make people happy However, there is one thing that makes him happier than all others, and that thing can differ from person to person. That&#8217;s why Nature has so many beautiful things. Choose the one you want.</p>
<p><strong>Moral:</strong> Never just rely on other&#8217;s judgement about programming languages. Try it out for yourself. Does it work for you? It&#8217;s ultimately you who are in need.</p>
<p><strong>Disclaimer:</strong> By language wars, I mean only those &#8220;baseless&#8221; flame wars that take place. You&#8217;d only find people throwing stones at each other. However, healthy discussion about a language&#8217;s merits and demerits compared to other languages is good.</p>
<p><strong>What do you think?</strong> I&#8217;d love to know your views on it.</p>
<p><strong>Update: Added Amazon links to some good Perl books</strong></p>
<p><iframe src="http://rcm.amazon.com/e/cm?t=revolves-20&#038;o=1&#038;p=8&#038;l=as1&#038;asins=0596520107&#038;fc1=000000&#038;IS2=1&#038;lt1=_blank&#038;m=amazon&#038;lc1=0000FF&#038;bc1=000000&#038;bg1=FFFFFF&#038;f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe> <iframe src="http://rcm.amazon.com/e/cm?t=revolves-20&#038;o=1&#038;p=8&#038;l=as1&#038;asins=0596102062&#038;fc1=000000&#038;IS2=1&#038;lt1=_blank&#038;m=amazon&#038;lc1=0000FF&#038;bc1=000000&#038;bg1=FFFFFF&#038;f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe> <iframe src="http://rcm.amazon.com/e/cm?t=revolves-20&#038;o=1&#038;p=8&#038;l=as1&#038;asins=0596000278&#038;fc1=000000&#038;IS2=1&#038;lt1=_blank&#038;m=amazon&#038;lc1=0000FF&#038;bc1=000000&#038;bg1=FFFFFF&#038;f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.revolves.net/2010/01/17/perl-ends-language-wars/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl vs Python &#8211; The Final Battle</title>
		<link>http://www.revolves.net/2009/11/29/perl-vs-python-the-final-battle/</link>
		<comments>http://www.revolves.net/2009/11/29/perl-vs-python-the-final-battle/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 12:54:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.revolves.net/?p=264</guid>
		<description><![CDATA[You might have already seen a lot of Perl vs Python stuff. So I&#8217;m telling you in advance that I&#8217;ve too have read them all, and what you&#8217;re going to read here would be completely different than what you already have. Firstly, let me start by saying that Perl and Python are great languages. But [...]]]></description>
			<content:encoded><![CDATA[<p>You might have already seen a lot of Perl vs Python stuff. So I&#8217;m telling you in advance that I&#8217;ve too have read them all, and what you&#8217;re going to read here would be completely different than what you already have.</p>
<p>Firstly, let me start by saying that Perl and Python are great languages. But they have their own differences, which is precisely why we have two different languages. If they were the same, why have two different languages at all?</p>
<p>The people who are biased against a language are the one who try to write Python in Perl or Perl in Python. They want Perl to work like Python or vice versa. And if you&#8217;re intelligent enough, you&#8217;ll quickly understand that there is no point in having them both work in the exact same way.<span id="more-264"></span></p>
<p>I&#8217;ll shout out one basic difference between the two. This is one difference a beginner will likely notice. I won&#8217;t mention many of the &#8220;advanced differences&#8221;, for an experienced programmer doesn&#8217;t need my help for that.</p>
<p>Perl has only one primary data type, called a &#8220;scalar.&#8221; In Python, we have different types, i.e. int, string etc. You need not specify the type of the data a variable will hold, since both of these languages will find out about that themselves.</p>
<p>Once you store a number in a Python variable, the variable obtains a type int. You can&#8217;t concatenate a string and an integer like this: <em>&#8220;hello&#8221; + s</em>, where you might have previously written: <em>&#8216;s = 3&#8242;</em>. You have to explicitly convert that number into a string using <em>&#8216;str(s)&#8217;</em>.</p>
<p>Now, Perl doesn&#8217;t know the difference between a string and a number. Because all we have is scalar. So, how does Perl work then? Perl determines the type of your variable depending on the context. If you have <em>&#8216; $s = &#8220;3&#8243; &#8216;</em>, and then you write <em>&#8216; print $s * 4 &#8216;</em>, Perl will print 12. Thus, when used in a numeric context, there is no difference between <em>&#8216; $s = 3 &#8216;</em> and <em>&#8216; $s = &#8220;3&#8243; &#8216;</em>.</p>
<p>This basic fact also influenced various further design decisions. In Python, <em>&#8220;hello&#8221; * 4</em> would give &#8220;hellohellohellohello&#8221; while <em>4 * 4</em> would give 16. But if you type <em>&#8220;hello&#8221; * 4</em> in Perl, it&#8217;ll give you 0. This is because, since you&#8217;ve used &#8216;*&#8217;, Perl thinks it&#8217;s a numeric context. It solely determines datatype on basis of context. So, it fruitlessly tries converting &#8220;hello&#8221; into an integer, which yields 0 at worst. But had our string been &#8220;4hello5&#8243;, Perl would have converted it into 4.</p>
<p>That&#8217;s why Perl has a separate operator for multiplying strings. Here, typing <em>&#8220;hello&#8221; x 4</em> would print &#8220;hellohellohellohello&#8221;. The use of &#8216;x&#8217; yells string context.</p>
<p>It might seem impossible to program using such &#8220;contextual&#8221; data. But that&#8217;s how we use our natural language. In English, every word can have different meaning on the basis of context. But it still doesn&#8217;t confuse you when properly used.</p>
<p>Another little example where beginners can get trapped. In Python, there are &#8216;int&#8217; and &#8216;float&#8217; data types. The former stores integers while the latter stores numbers having decimal point. So, looking at the type, you can pretty much know whether a variable would have a decimal point or not.</p>
<p>But Perl performs all calculations in floating-points. I.e., for it all numbers are floating points. Thus, it has a function called &#8216;int&#8217;. If you have <em>&#8216;$s = 3.5&#8242;</em> and you do <em>&#8216;$s = int($s)&#8217;</em>, you&#8217;ll get 3 in $s. So, has Perl converted your decimal number into an integer? No! Remember, we only have a scalar datatype. Perl has merely truncated anything after the decimal point. That&#8217;s why there is no function to convert integers to floating points.</p>
<p>This sounds a little counter-intuitive just because we try to use our knowledge of other languages while learning a new language. We want the new language to work like the languages we&#8217;ve already learnt. Keep an open mind.</p>
<p>So, what&#8217;s the conclusion? I&#8217;m personally learning them both. Why? It&#8217;s easier to learn them both rather than fighting which one&#8217;s better. Python is elegant and powerful, and Perl has come crazy shortcuts which can help get tasks done quickly (of course, at a cost). They both have their own pluses and minuses. You should find their strengths and weaknesses for yourself, rather than being influenced by someone else.</p>
<p>And to people who say Perl is unreadable. If you know Perl, it is easy to read, else it&#8217;s going to be tough (obviously). If you can learn regex, you can learn Perl.</p>
<p>For Perl, the Llama or &#8216;Learning Perl&#8217; book by O&#8217;Reilly is great. For Python, you can find great tutorials pretty much everywhere. I&#8217;d recommend practicing the same programs both in Python and Perl initially, to develop a knack for how these languages work.</p>
<p><strong>Update: Added Amazon links to good Perl books</strong></p>
<p><iframe src="http://rcm.amazon.com/e/cm?t=revolves-20&#038;o=1&#038;p=8&#038;l=as1&#038;asins=0596520107&#038;fc1=000000&#038;IS2=1&#038;lt1=_blank&#038;m=amazon&#038;lc1=0000FF&#038;bc1=000000&#038;bg1=FFFFFF&#038;f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe> <iframe src="http://rcm.amazon.com/e/cm?t=revolves-20&#038;o=1&#038;p=8&#038;l=as1&#038;asins=0596102062&#038;fc1=000000&#038;IS2=1&#038;lt1=_blank&#038;m=amazon&#038;lc1=0000FF&#038;bc1=000000&#038;bg1=FFFFFF&#038;f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe> <iframe src="http://rcm.amazon.com/e/cm?t=revolves-20&#038;o=1&#038;p=8&#038;l=as1&#038;asins=0596000278&#038;fc1=000000&#038;IS2=1&#038;lt1=_blank&#038;m=amazon&#038;lc1=0000FF&#038;bc1=000000&#038;bg1=FFFFFF&#038;f=ifr" style="width:120px;height:240px;" scrolling="no" marginwidth="0" marginheight="0" frameborder="0"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.revolves.net/2009/11/29/perl-vs-python-the-final-battle/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.263 seconds -->
