I try to call a Subroutine in Perl but I get this error "Malformed prototype for main". I have a Subroutine Compare and I have to pass to it two integer.
#!/usr/bin/perl
@ListA=(1,2,3);
@ListB=(2,3,4);
@ListResult;
#AND
sub Compare($p1,$p2){
if($p1 > sizeof(ListA) or $p2 > sizeof(ListB))
{
return;}
if(ListA($p1) = ListB($p2)){
push (@ListResult, ListA($p1));
Compare($p1+1,$p2+1);
return;
}
if(ListA($p1) > ListB($p2)){
Compare($p1,$p2+1);
return;
}
else {
Compare($p1+1,$p2);
return;
}
return;
}
Compare(1,1);
Please help me and explain how to correct this programm.