The Code

package MyMath;

use strict;
use warnings;

=head1

My math funcs

=cut

=item
factorial($whole_positive_number)
NOTE: No digit delimiters accepted
=cut

sub factorial {
    my ($in) = (@_);

    die "Input not defined" unless defined $in;
    die "Invalid input $in" unless $in =~ m/\d+/;

    return 1 if $in == 0;

    return ( $in * factorial($in - 1) );
}

1;