#!\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
shensteffi 0 Newbie Poster
2teez 43 Posting Whiz
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.