use strict;
use warnings FATAL => 'all';

sub factorial{
    my $factor = shift @_;
    my $ret = 1;
    while ($factor > 0) {
        $ret = $ret * $factor--;
    }
    return $ret;
}

print factorial(7);
