<?xml version="1.0" encoding="windows-1252"?>
<node id="1000426" title="Re^3: New student, can we write this program in perl..." created="2012-10-22 19:23:24" updated="2012-10-22 19:23:24">
<type id="11">
note</type>
<author id="105128">
Jenda</author>
<data>
<field name="doctext">
&lt;code&gt;
use strict;
# #include&lt;conio.h&gt;
#void main()
#{
my (@a,@b,@c,$i,$j,$k,$n);

print("Enter the number of elements\n");
$n = &lt;&gt;;
printf("Enter  %d numbers\n",$n);
for($i=0;$i&lt;$n;$i++)
{
  push @a, scalar(&lt;&gt;);
}
for($i=0;$i&lt;$n;$i++)
{
  if(($a[$i]%2)==0)
  {
    $b[$j]=$a[$i];
    $j++;
  }
  else
  {
    $c[$k]=$a[$i];
    $k++;
  }
}
print("The  even numbers  are\n");
for($i=0;$i&lt;$j;$i++)
{
printf("%d\n",$b[$i]);
}
printf("The odd numbers are\n");
for($i=0;$i&lt;$k;$i++)
{
 printf("%d\n",$c[$i]);
}
&lt;&gt;;
#}
&lt;/code&gt;

&lt;p&gt;Not that this was the best (or even just a particularly good) way to write this, but it's the minimal change. Huge difference from the C code, right?&lt;/p&gt;

&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-105128"&gt;
&lt;p&gt;Jenda&lt;br&gt;
&lt;b&gt;Enoch was right!&lt;/b&gt;&lt;br/&gt;
Enjoy the last years of Rome.
&lt;/p&gt;

&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
999976</field>
<field name="parent_node">
999980</field>
</data>
</node>
