Perl

What is Perl POD? Can you code an example?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

From the official docs:

"Pod is a simple-to-use markup language used for writing documentation for Perl, Perl programs, and Perl modules."

=item
    This function returns the factorial of a number.
    Input: $n (number you wanna calculate).
    Output: number factorial.
=cut
sub factorial {
    my ($i, $result, $n) = (1, 1, shift);
    $result = $result *= $i && $i++ while $i <= $n;
    return $result;
}