I am new to perl programming and I am trying to build a script using several subroutines on it. For a start I am trying to run a short mocke script to work out subroutines behaviour, but I don't get to understand the input.
Here is my code:
sub prueba{
my (@array1, @array2)=@_;
if (scalar(@array1)<scalar(@array2)) {
print @array1,"\n";
} elsif (scalar(@array1)>scalar(@array2)){
print @array2,"\n";
}
};
my @primero=(1,5,9);
my @segundo=(1,7,8,9,6,5,6,9);
prueba(@primero,@segundo);
I am passing two arrays and I want the subroutine to retrieve the answer according to those arrays, but when I run it I get no output, not even warning errors messages... I already tried using the refference to the array, but still not working:
sub prueba{
my (@array1, @array2)=@_;
if (scalar(@array1)<scalar(@array2)) {
print @array1,"\n";
} elsif (scalar(@array1)>scalar(@array2)){
print @array2,"\n";
}
};
my @primero=(1,5,9);
my @segundo=(1,7,8,9,6,5,6,9);
prueba(\@primero,\@segundo);