G
Gerhard M
first of all an simple program:
use Math::BigInt;
use warnings;
my $v = new Math::BigInt;
sub faculty ($);
$v= faculty($ARGV[0]);
print $v,"\n";
sub faculty ($) {
my $v=shift;
return ( $v>1 ? $v*faculty($v -1) : 1 );
}
If executing with argument 99 there's no problem, but if using 100 as
argument i'll get the warning:
Deep recursion on subroutine "main::faculty" at recursive.pl line 13.
1) How can i redefine the recursion level to keep down this warning?
2) Is it possible to add a level of recursion to die the program
(instead to warn)?
regards
gerhard
use Math::BigInt;
use warnings;
my $v = new Math::BigInt;
sub faculty ($);
$v= faculty($ARGV[0]);
print $v,"\n";
sub faculty ($) {
my $v=shift;
return ( $v>1 ? $v*faculty($v -1) : 1 );
}
If executing with argument 99 there's no problem, but if using 100 as
argument i'll get the warning:
Deep recursion on subroutine "main::faculty" at recursive.pl line 13.
1) How can i redefine the recursion level to keep down this warning?
2) Is it possible to add a level of recursion to die the program
(instead to warn)?
regards
gerhard