You are viewing the version of this documentation from Perl blead. This is the main development branch of Perl. (git commit f3409f8e6576df3a1ea1cf0356e5016d3247a046)
log EXPR
log

Returns the natural logarithm (base e) of EXPR. If EXPR is omitted, returns the log of $_. To get the log of another base, use basic algebra: The base-N log of a number is equal to the natural log of that number divided by the natural log of N. For example:

sub log10 {
    my $n = shift;
    return log($n)/log(10);
}

See also exp for the inverse operation.