From 7054587111dc779ec717b775c059f274c36dcba0 Mon Sep 17 00:00:00 2001 From: Paulo Custodio Date: Fri, 31 Mar 2023 16:22:41 +0100 Subject: Add Perl solution --- challenge-179/paulo-custodio/perl/ch-1.pl | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/challenge-179/paulo-custodio/perl/ch-1.pl b/challenge-179/paulo-custodio/perl/ch-1.pl index 33f0100618..b6e72af146 100644 --- a/challenge-179/paulo-custodio/perl/ch-1.pl +++ b/challenge-179/paulo-custodio/perl/ch-1.pl @@ -16,23 +16,6 @@ # 99 => ninety-ninth use Modern::Perl; -use Number::Spell; +use Lingua::EN::Numbers 'num2en_ordinal'; -sub ordinal_number_spelling { - my($n) = @_; - my $str = spell_number($n); - $str =~ s/twelve$/twelfth/ or - $str =~ s/one$/first/ or - $str =~ s/two$/second/ or - $str =~ s/three$/third/ or - $str =~ s/four$/forth/ or - $str =~ s/five$/fifth/ or - $str =~ s/eight$/eighth/ or - $str =~ s/nine$/ninth/ or - $str =~ s/y$/ieth/ or - $str =~ s/$/th/; - $str =~ s/ /-/g; - return $str; -} - -say ordinal_number_spelling(shift); +say num2en_ordinal(shift); -- cgit