- Perl ›
- builtin functions ›
- here
exp function - Get the base Napier number e of the natural logarithm
You can use the exp function to get the base Napier number e of the natural logarithm.
# e my $exp = exp(1); # e cubed my $exp3 = exp(3);
To get the number e, pass 1 to the exp function. The argument is a power of power, so if you specify n, you can get the number of e raised to the nth power.
Example
use strict; use warnings; print "(1) Napier number e\n"; print "e =" . exp(1). "\n\n"; print "(2) Napier number e to the nth root\n"; print "e cubed =" . Exp (3) . "\n";