{ package Maths; sub factorial { my $n = int(pop); return $n if $n<2; $n * factorial($n - 1) } } use Test::More; my @expected = qw/ 0 1 2 6 24 100 720 /; plan tests => scalar @expected; is(Maths::factorial($_), $expected[$_], "Factorial of $_") for 0 .. $#expected;