I’m trying to write the following recursive function. The problem is that it never ends and I can’t understand why:
sub do_smth(@first, @second){
my @tmp_first = @first;
$tmp = shift(@tmp_first);
if (@tmp_first > 0){
do_smth(@tmp_first, @second);
}
my @tmp_second = @second;
$tmp = shift(@tmp_second);
if (@tmp_second > 0){
do_smth(@first, @tmp_second);
}
}
This code does not even compile. Without warnings and strict you will get these errors:
and with warnings and strict:
I dont know what you are trying to do, but here is your code with the proper syntax: