#!\strawberry\perl\bin
print"Enter the number of column\n";
$r=<stdin>;
print"\nEnter the numer of row\n";
$c=<stdin>;
print"\neNTER THE sEQUENCE FOR THE ROW\n";
$i=0;
for($j=1;$j<=$c;$j++)
{
$a[$i][$j]=<stdin>;
}
print"\neNTER THE sEQUENCE FOR THE ROW\n";
$j=0;
for($i=1;$i<=$r;$i++)
{
$a[$i][$j]=<stdin>;
}
$i=0;
{
for($j=0;$j<=$c;$j++)
{
chomp $a[$i][$j];
print"\t$a[$i][$j]";
}
print"\n";
}
for($i=1;$i<=$r;$i++)
{
$j=0;
{
chomp $a[$i][$j];
print"\t$a[$i][$j]";
}
print"\n";
}
print"\nSubstitution matrix is\n";
$b[0][1]='A';
$b[0][2]='C';
$b[0][3]='G';
$b[0][4]='T';
$b[1][0]='A';
$b[2][0]='C';
$b[3][0]='G';
$b[4][0]='T';
$d=5;
$v=5;
for($i=1;$i<=$d;$i++)
{
for($j=1;$j<=$v;$j++)
{
chomp($b[$i][$j]);
print"\t$b[$i][$j]";
}
print"\n";                                                      
}
for($i=0;$i<$d;$i++)
{
for($j=0;$j<$v;$j++)
{
chomp($b[$i][$j]);
}
print"\n";                                                      
}
for($i=1;$i<=5;$i++)
{
for($j=1;$j<=5;$j++)
{
if($b[$i][$j-$j]=~m($b[$i-$i][$j]))
{
$b[$i+1][$j+1]='2';
}
elseif
{
$b[$i+1][$j+1]='0';
}
}
print"\n";
}
for($i=0;$i<=5;$i++)
{
for($j=0;$j<=5;$j++)
{
chomp($b[$i][$j]);
print"\t$b[$i][$j]";
}
print"\n";                                                      
}


<>


In this program For the Second Matrix i need the following output

            A      G      T       C
      A     2      1      -1      -1
      G     1      2      -1       -1
      T     -1     -1      2        1
      C     -1      -1     1        2

Hi shensteffi,
Please, note that you can't just dump codes on people to resolve for you. Or expect people to know what you are thinking because you put several lines together to do some stuff for you.
If you are asking for help, then you should ask nicely. Explain, whant you want done. Show example of how your input and output will look like. What you have done so far and where you are having problems. Am sure, people are more willing to help than you could ever think.
That been said, I think you might have to check the use of your chomp, REs i.e m//. The if iteration you wrote should also have else not elsif.
Taking of elsif, in Perl there is nothing as elseif, but elsif!!
Lastly, you should use the following pragma in your code:

  1. use warnings;
  2. use strict;

These help alot to shield you from several error to start with. However, it's not a must.
Finally, let get this program working. Tell us what you want done, how your input looks like. What you are trying to achieve with your code and what result you are expecting as output.
You know Perl makes easy tasks easy and difficult tasks possible
Hope this helps.
Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.