sub fact5{ #no recursion at all my $n = Math::BigInt->new(1); foreach my $i (1..shift) { $n = Math::BigInt->new($n->bmul($i)); } return $n; }