<?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>MemoSoup &#187; Perl</title>
	<atom:link href="http://www.memosoup.com/category/scripts/perl/feed" rel="self" type="application/rss+xml" />
	<link>http://www.memosoup.com</link>
	<description>Mix of the things I always forget</description>
	<lastBuildDate>Tue, 07 Feb 2012 00:03:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Perl: SOAP problem with dateTime</title>
		<link>http://www.memosoup.com/20111110/perl-soap-problem-with-datetime.html</link>
		<comments>http://www.memosoup.com/20111110/perl-soap-problem-with-datetime.html#comments</comments>
		<pubDate>Thu, 10 Nov 2011 16:29:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[perl soap date]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=428</guid>
		<description><![CDATA[<p>The following error message was received by Perl application: Unrecognized type &#8216;{http://www.w3.org/1999/XMLSchema}dateTime</p> <p>The problem is caused by &#8220;dateTime&#8221; type: it was not supported in the 1999 XML Specification. The solution is to switch to 2001 schema:</p> &#160;my $soap = SOAP::Lite-&#62;uri&#40; $NAMESPACE &#41;-&#62;proxy&#40; $PROXY_URL &#41;-&#62;xmlschema &#40;'2001'&#41;; Tweet news and informations&#160;automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel]]></description>
			<content:encoded><![CDATA[<p>The following error message was received by Perl application:<br />
<strong>Unrecognized type &#8216;{http://www.w3.org/1999/XMLSchema}dateTime</strong></p>
<p>The problem is caused by &#8220;dateTime&#8221; type: it was not supported in the 1999 XML Specification.<br />
The solution is to switch to 2001 schema:</p>
<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$soap</span> <span style="color: #339933;">=</span> SOAP<span style="color: #339933;">::</span><span style="color: #006600;">Lite</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">uri</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$NAMESPACE</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">proxy</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$PROXY_URL</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">xmlschema</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'2001'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20111110%2Fperl-soap-problem-with-datetime.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20111110/perl-soap-problem-with-datetime.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="Perl: SOAP problem with dateTime" data-url="http://www.memosoup.com/20111110/perl-soap-problem-with-datetime.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20111110/perl-soap-problem-with-datetime.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl: Soap deserialization error</title>
		<link>http://www.memosoup.com/20110729/perl-soap-deserialization-error.html</link>
		<comments>http://www.memosoup.com/20110729/perl-soap-deserialization-error.html#comments</comments>
		<pubDate>Fri, 29 Jul 2011 13:08:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[soap]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=423</guid>
		<description><![CDATA[<p>Sometimes the following error is displayed, if application uses the old version of CPAN SOAP module: &#8220;Client Application failed during request deserialization: no element found at line 1, column 0, byte -1 at XML/Parser.pm&#8221;</p> <p>The possilbe solution is to change SOAP::Transport::HTTP module (SOAP/Transport/HTTP.pm), function &#8220;handle&#8221;:</p> sysread&#40; STDIN, $buffer, $length &#41; <p>should be replaced by</p> read&#40; [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes the following error is displayed, if application uses the old version of CPAN SOAP module:<br />
<em>&#8220;Client Application failed during request deserialization: no element found at line 1, column 0, byte -1 at XML/Parser.pm&#8221;</em></p>
<p>The possilbe solution is to change SOAP::Transport::HTTP module (SOAP/Transport/HTTP.pm), function &#8220;handle&#8221;:</p>
<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://perldoc.perl.org/functions/sysread.html"><span style="color: #000066;">sysread</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">STDIN</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$buffer</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$length</span> <span style="color: #009900;">&#41;</span></div></div>
<p>should be replaced by</p>
<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://perldoc.perl.org/functions/read.html"><span style="color: #000066;">read</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">STDIN</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$buffer</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$length</span> <span style="color: #009900;">&#41;</span></div></div>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20110729%2Fperl-soap-deserialization-error.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20110729/perl-soap-deserialization-error.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="Perl: Soap deserialization error" data-url="http://www.memosoup.com/20110729/perl-soap-deserialization-error.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20110729/perl-soap-deserialization-error.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl: get file checksum</title>
		<link>http://www.memosoup.com/20100608/perl-get-file-checksum.html</link>
		<comments>http://www.memosoup.com/20100608/perl-get-file-checksum.html#comments</comments>
		<pubDate>Tue, 08 Jun 2010 15:12:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[checksum]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[md5]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=286</guid>
		<description><![CDATA[use Digest::MD5; use IO::File; my $chk = Digest::MD5-&#62;new&#40;&#41;; foreach my $file &#40;@ARGV&#41; &#123; &#160; &#160; $chk-&#62;addfile&#40;IO::File-&#62;new&#40;$file&#41;&#41;; &#160; &#160; print &#34;$file -&#62; &#34;,$chk-&#62;hexdigest,&#34;\n&#34;; &#125; <p>The additional details could be found on IBM site</p> Tweet news and informations&#160;automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel]]></description>
			<content:encoded><![CDATA[<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">use</span> Digest<span style="color: #339933;">::</span><span style="color: #006600;">MD5</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> IO<span style="color: #339933;">::</span><span style="color: #006600;">File</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$chk</span> <span style="color: #339933;">=</span> Digest<span style="color: #339933;">::</span><span style="color: #006600;">MD5</span><span style="color: #339933;">-&gt;</span><span style="color: #000000; font-weight: bold;">new</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">foreach</span> <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$file</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><span style="color: #000000; font-weight: bold;">ARGV</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$chk</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">addfile</span><span style="color: #009900;">&#40;</span>IO<span style="color: #339933;">::</span><span style="color: #006600;">File</span><span style="color: #339933;">-&gt;</span><span style="color: #000000; font-weight: bold;">new</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;$file -&gt; &quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$chk</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">hexdigest</span><span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>The additional details could be found on <a href="http://www.ibm.com/developerworks/aix/library/au-satsystemvalidity/index.html?S_TACT=105AGX99">IBM site</a></p>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20100608%2Fperl-get-file-checksum.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20100608/perl-get-file-checksum.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="Perl: get file checksum" data-url="http://www.memosoup.com/20100608/perl-get-file-checksum.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20100608/perl-get-file-checksum.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unix: get the file date</title>
		<link>http://www.memosoup.com/20090918/unix-get-the-file-date.html</link>
		<comments>http://www.memosoup.com/20090918/unix-get-the-file-date.html#comments</comments>
		<pubDate>Fri, 18 Sep 2009 15:08:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=132</guid>
		<description><![CDATA[ls -1 &#124; cpio -o &#124; cpio -ivt &#124; awk '{print $NF, $(NF-1), $(NF-4), $(NF-3) }' <p>Warning: I/O expensive for the large files!</p> <p>Perl:</p> @a = localtime&#40;&#40;stat&#40;$my_file&#41;&#41;&#91;9&#93;&#41;; $a&#91;4&#93;++; printf &#34;%02d%02d%02d&#34;,@a&#91;5,4,3&#93;; Tweet news and informations&#160;automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel]]></description>
			<content:encoded><![CDATA[<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cpio</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cpio</span> <span style="color: #660033;">-ivt</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $NF, $(NF-1), $(NF-4), $(NF-3) }'</span></div></div>
<p><strong>Warning: </strong>I/O expensive for the large files!</p>
<p><strong>Perl:</strong></p>
<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0000ff;">@a</span> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/localtime.html"><span style="color: #000066;">localtime</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><a href="http://perldoc.perl.org/functions/stat.html"><span style="color: #000066;">stat</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$my_file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">9</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #0000ff;">$a</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">++;</span><br />
<a href="http://perldoc.perl.org/functions/printf.html"><span style="color: #000066;">printf</span></a> <span style="color: #ff0000;">&quot;%02d%02d%02d&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">@a</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">5</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></div></div>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20090918%2Funix-get-the-file-date.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20090918/unix-get-the-file-date.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="Unix: get the file date" data-url="http://www.memosoup.com/20090918/unix-get-the-file-date.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20090918/unix-get-the-file-date.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Calculating the date of Easter</title>
		<link>http://www.memosoup.com/20090915/calculating-the-date-of-easter.html</link>
		<comments>http://www.memosoup.com/20090915/calculating-the-date-of-easter.html#comments</comments>
		<pubDate>Tue, 15 Sep 2009 21:55:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[easter]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=106</guid>
		<description><![CDATA[<p>The easiest way is to use specialized package (like Date::Calc). If You need standalone function, the following method could be used.</p> #!/usr/bin/perl $year=$ARGV&#91; 0 &#93;; $isJulian=&#40;defined&#40;$ARGV&#91; 1 &#93;&#41; &#38;&#38; $ARGV&#91; 1 &#93; eq 'julian'&#41;; $isOrthodox=&#40;defined&#40;$ARGV&#91; 1 &#93;&#41; &#38;&#38; $ARGV&#91; 1 &#93; eq 'orthodox'&#41;; my &#40; $G , $C , $H, $I, $J , $L &#41;; [...]]]></description>
			<content:encoded><![CDATA[<p>The easiest way is to use specialized package (like Date::Calc).<br />
If You need standalone function, the following method could be used.</p>
<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span><br />
<br />
<span style="color: #0000ff;">$year</span><span style="color: #339933;">=</span><span style="color: #0000ff;">$ARGV</span><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #0000ff;">$isJulian</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><a href="http://perldoc.perl.org/functions/defined.html"><span style="color: #000066;">defined</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$ARGV</span><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #0000ff;">$ARGV</span><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">eq</span> <span style="color: #ff0000;">'julian'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #0000ff;">$isOrthodox</span><span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><a href="http://perldoc.perl.org/functions/defined.html"><span style="color: #000066;">defined</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$ARGV</span><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #0000ff;">$ARGV</span><span style="color: #009900;">&#91;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">eq</span> <span style="color: #ff0000;">'orthodox'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$G</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">$C</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">$H</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$I</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$J</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">$L</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #0000ff;">$G</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$year</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">19</span> <span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$isJulian</span> <span style="color: #339933;">||</span> <span style="color: #0000ff;">$isOrthodox</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp;<a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$isJulian</span> <span style="color: #339933;">?</span> <span style="color: #ff0000;">&quot;Julian:&quot;</span> <span style="color: #339933;">:</span> <span style="color: #ff0000;">&quot;Orthodox:&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #0000ff;">$I</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">19</span><span style="color: #0000ff;">*$G</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">15</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">30</span> <span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #0000ff;">$J</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$year</span> <span style="color: #339933;">+</span> <a href="http://perldoc.perl.org/functions/int.html"><span style="color: #000066;">int</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$year</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">$I</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">7</span> <span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span><br />
&nbsp; <a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;Gregorian:&quot;</span> <span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #0000ff;">$C</span> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/int.html"><span style="color: #000066;">int</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$year</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">100</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #0000ff;">$H</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$C</span> <span style="color: #339933;">-</span> <a href="http://perldoc.perl.org/functions/int.html"><span style="color: #000066;">int</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$C</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <a href="http://perldoc.perl.org/functions/int.html"><span style="color: #000066;">int</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">8</span><span style="color: #0000ff;">*$C</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">13</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">25</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">19</span><span style="color: #0000ff;">*$G</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">15</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">30</span> <span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #0000ff;">$I</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$H</span> <span style="color: #339933;">-</span> <a href="http://perldoc.perl.org/functions/int.html"><span style="color: #000066;">int</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$H</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">28</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">-</span> <a href="http://perldoc.perl.org/functions/int.html"><span style="color: #000066;">int</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$H</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">28</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><a href="http://perldoc.perl.org/functions/int.html"><span style="color: #000066;">int</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">29</span><span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$H</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><a href="http://perldoc.perl.org/functions/int.html"><span style="color: #000066;">int</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">21</span> <span style="color: #339933;">-</span> <span style="color: #0000ff;">$G</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">11</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #0000ff;">$J</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$year</span> <span style="color: #339933;">+</span> <a href="http://perldoc.perl.org/functions/int.html"><span style="color: #000066;">int</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$year</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">$I</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">-</span> <span style="color: #0000ff;">$C</span> <span style="color: #339933;">+</span> <a href="http://perldoc.perl.org/functions/int.html"><span style="color: #000066;">int</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$C</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">7</span> <span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #0000ff;">$L</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$I</span> <span style="color: #339933;">-</span> <span style="color: #0000ff;">$J</span> <span style="color: #339933;">;</span><br />
<span style="color: #0000ff;">$EasterMonth</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span> <span style="color: #339933;">+</span> <a href="http://perldoc.perl.org/functions/int.html"><span style="color: #000066;">int</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$L</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">40</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">44</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span><br />
<span style="color: #0000ff;">$EasterDay</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$L</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">28</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">31</span><span style="color: #339933;">*</span><a href="http://perldoc.perl.org/functions/int.html"><span style="color: #000066;">int</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$EasterMonth</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$isOrthodox</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp;<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$EasterDay</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$EasterMonth</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$year</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> EasterOrthodox<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$EasterDay</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$EasterMonth</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$year</span> <span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<a href="http://perldoc.perl.org/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Day=%d Mon=%d Year=%d <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$EasterDay</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$EasterMonth</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$year</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">sub</span> EasterOrthodox <br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$pDay</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$pMonth</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$pYear</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span> <span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$extra</span> <span style="color: #339933;">,</span> <span style="color: #0000ff;">$tmp</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$rezDay</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$rezMonth</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$pYear</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1582</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$pYear</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">4099</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$extra</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$pYear</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1600</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">$tmp</span> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/int.html"><span style="color: #000066;">int</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$pYear</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">100</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">16</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">$extra</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$extra</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">$tmp</span> <span style="color: #339933;">-</span> <a href="http://perldoc.perl.org/functions/int.html"><span style="color: #000066;">int</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$tmp</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$rezDay</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$pDay</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">$extra</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$rezMonth</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$pMonth</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$rezMonth</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$rezDay</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">31</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">$rezMonth</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">$rezDay</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$rezDay</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">31</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$rezMonth</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$rezDay</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">30</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">$rezMonth</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">$rezDay</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$rezDay</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">30</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#125;</span><br />
&nbsp;<a href="http://perldoc.perl.org/functions/return.html"><span style="color: #000066;">return</span></a> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$rezDay</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$rezMonth</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$pYear</span> <span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>Examples:<br />
 perl -w 2006<br />
 perl -w 2006 orthodox</p>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20090915%2Fcalculating-the-date-of-easter.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20090915/calculating-the-date-of-easter.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="Calculating the date of Easter" data-url="http://www.memosoup.com/20090915/calculating-the-date-of-easter.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20090915/calculating-the-date-of-easter.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

