#!/usr/bin/env perl use utf8; use Utils; use strict; use warnings; sub factorial { my ($x) = @_; if ($x <= 1) { return 1; } return $x * factorial($x - 1); } MAIN: { binmode(STDOUT, ":utf8"); binmode(STDERR, ":utf8"); binmode(STDIN, ":utf8"); for (my $x = 1; $x < 10; ++$x) { print Utils::messageFormat("\{0:d\}! = \{1:d\}", $x, factorial($x)), "\n"; } }