<?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>Krix Apolinário &#187; Perl</title>
	<atom:link href="http://blog.krix.com.br/tag/perl/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.krix.com.br</link>
	<description></description>
	<lastBuildDate>Fri, 23 Jul 2010 18:20:24 +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>Ano Bissexto</title>
		<link>http://blog.krix.com.br/2008/05/22/ano-bissexto/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=ano-bissexto</link>
		<comments>http://blog.krix.com.br/2008/05/22/ano-bissexto/#comments</comments>
		<pubDate>Thu, 22 May 2008 14:56:21 +0000</pubDate>
		<dc:creator>Krix Apolinário</dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://blog.krix.com.br/?p=102</guid>
		<description><![CDATA[Olá, Hoje estava organizando meus arquivos e encontrei um script que havia feito em perl bem simples para saber se o ano que informo é ou não bissexto. Abaixo está o código. #!/usr/bin/perl -w &#160; print -n &#34;Informe o ano: &#34;; $ano = &#38;lt;STDIN&#38;gt;; chomp $ano; &#160; cal 2 $ano &#124; grep -i 29 &#38;gt;&#38;gt; [...]]]></description>
			<content:encoded><![CDATA[<p>Olá,</p>
<p>Hoje estava organizando meus arquivos e encontrei um script que havia feito em perl bem simples para saber se o ano que informo é ou não bissexto. Abaixo está o código. <img src='http://blog.krix.com.br/krix/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/perl -w</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span> -n <span style="color: #483d8b;">&quot;Informe o ano: &quot;</span><span style="color: #66cc66;">;</span>
$ano = <span style="color: #66cc66;">&amp;</span>lt<span style="color: #66cc66;">;</span>STDIN<span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;;</span>
chomp $ano<span style="color: #66cc66;">;</span>
&nbsp;
cal <span style="color: #ff4500;">2</span> $ano | grep -i <span style="color: #ff4500;">29</span> <span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;&amp;</span>gt<span style="color: #66cc66;">;</span> /dev/null
teste=<span style="color: #66cc66;">`</span>echo $<span style="color: #66cc66;">?`</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;$teste&quot;</span> == <span style="color: #483d8b;">&quot;0&quot;</span><span style="color: black;">&#41;</span> <span style="color: black;">&#123;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;O ano &quot;</span>$ano<span style="color: #483d8b;">&quot; é bissexto!&quot;</span>
<span style="color: black;">&#125;</span>
<span style="color: #ff7700;font-weight:bold;">else</span> <span style="color: black;">&#123;</span>
echo <span style="color: #483d8b;">&quot;O ano &quot;</span>$ano<span style="color: #483d8b;">&quot; não é bissexto!&quot;</span>
<span style="color: black;">&#125;</span></pre></div></div>

<p style="text-align: center;">:wq!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.krix.com.br/2008/05/22/ano-bissexto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script Simples Para Saber o Tipo de Triângulo!</title>
		<link>http://blog.krix.com.br/2007/07/09/script-simples-para-saber-o-tipo-de-triangulo/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=script-simples-para-saber-o-tipo-de-triangulo</link>
		<comments>http://blog.krix.com.br/2007/07/09/script-simples-para-saber-o-tipo-de-triangulo/#comments</comments>
		<pubDate>Mon, 09 Jul 2007 19:02:00 +0000</pubDate>
		<dc:creator>Krix Apolinário</dc:creator>
				<category><![CDATA[Códigos]]></category>
		<category><![CDATA[Linguagem]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://blog.krix.com.br/2007/07/09/script-simples-para-saber-o-tipo-de-triangulo/</guid>
		<description><![CDATA[Na universidade na cadeira de Desenvolvimento, criávamos muitos scripts simples como o que mostrarei abaixo. Ele está comentado já para facilitar o entendimento dos IF e ELSIF. Basta colocar num arquivo dar permissão e executar&#8230; Muito simples de fazer e mais ainda executar! #!/usr/bin/perl -w &#160; # RECEBIMENTO DE DADOS. print &#34;Entre com o valor [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #009900;">Na universidade na cadeira de Desenvolvimento, criávamos muitos scripts simples como o que mostrarei abaixo.</span><br />
<span style="color: #009900;">Ele está comentado já para facilitar o entendimento dos IF e ELSIF.</span><br />
<span style="color: #009900;">Basta colocar num arquivo dar permissão e executar&#8230;</span><br />
<span style="color: #009900;">Muito simples de fazer e mais ainda executar!</span></p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl -w</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># RECEBIMENTO DE DADOS.</span>
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;Entre com o valor de cada lado do triângulo:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;Lado 1:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$v1</span> <span style="color: #339933;">=</span> <span style="color: #339933;">;</span>
<span style="color: #000066;">chomp</span> <span style="color: #0000ff;">$v1</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;Lado 2:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$v2</span> <span style="color: #339933;">=</span> <span style="color: #339933;">;</span>
<span style="color: #000066;">chomp</span> <span style="color: #0000ff;">$v2</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;Lado 3:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$v3</span> <span style="color: #339933;">=</span> <span style="color: #339933;">;</span>
<span style="color: #000066;">chomp</span> <span style="color: #0000ff;">$v3</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># O COMPRIMENTO DE UM LADO DO TRIÃNGULO É SEMPRE MENOR QUE A SOMA DOS OUTROS DOIS.</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$v1</span> <span style="color: #0000ff;">&amp;gt</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$v2</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">$v3</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">and</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$v2</span> <span style="color: #0000ff;">&amp;gt</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$v1</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">$v3</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">and</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$v3</span> <span style="color: #0000ff;">&amp;gt</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$v1</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">$v2</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;Não é um triângulo.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># NENHUM LADO DE UM TRIANGULO PODE SER ZERO.</span>
<span style="color: #b1b100;">elsif</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$v1</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">or</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$v2</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">or</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$v3</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;Nenhuma lado de um triângulo pode ser zero.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># SENDO TODOS OS LADOS IGUAIS EH UM TRIANGULO EQUILATERO.</span>
<span style="color: #b1b100;">elsif</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$v1</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">$v2</span> <span style="color: #b1b100;">and</span> <span style="color: #0000ff;">$v1</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">$v3</span> <span style="color: #b1b100;">and</span> <span style="color: #0000ff;">$v2</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">$v3</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;Ele é um triângulo equilatero.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># TENDO DOIS LADOS IGUAIS SERÁ UM TRIANGULO ISOSCELES.</span>
<span style="color: #b1b100;">elsif</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$v1</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">$v2</span> <span style="color: #b1b100;">and</span> <span style="color: #0000ff;">$v1</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">$v3</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">or</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$v1</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">$v3</span> <span style="color: #b1b100;">and</span> <span style="color: #0000ff;">$v1</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">$v2</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">or</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">$v2</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">$v3</span> <span style="color: #b1b100;">and</span> <span style="color: #0000ff;">$v2</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">$v1</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;Ele é um triângulo isósceles.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># TENDO TODOS OS LADOS DIFERENTES SERÁ ESCALENO.</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;Ele é um triângulo escaleno.<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.krix.com.br/2007/07/09/script-simples-para-saber-o-tipo-de-triangulo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
