in reply to Operations with Extremely Large Numbers

Two problems.
1.
sub factorial { my $n = @_;

This forces the @_ array to be evaluated in a scalar context. An array evaluated in a scalar context produces the length of the array. Useful - but not what you want in this case!

Change it to:
my ($n) = @_;

2.  my $exp = ($n/exp(1))^$n;
'^' is the bitwise XOR operator in perl.

Change to:
  my $exp = ($n/exp(1))**$n;

Actually there may be a third problem. I kicked this off before writing this response. My (admittedly lame) PC has been maxed out since.