aboutsummaryrefslogtreecommitdiff
path: root/challenge-179
diff options
context:
space:
mode:
authorPaulo Custodio <pauloscustodio@gmail.com>2023-03-31 16:22:41 +0100
committerPaulo Custodio <pauloscustodio@gmail.com>2023-03-31 16:22:41 +0100
commit7054587111dc779ec717b775c059f274c36dcba0 (patch)
treeaa804475b85603a729ff17ce92a1752cd9111e2b /challenge-179
parent6c50c3031c92781b134ce116ee99efc0a4fa1a36 (diff)
downloadperlweeklychallenge-club-7054587111dc779ec717b775c059f274c36dcba0.tar.gz
perlweeklychallenge-club-7054587111dc779ec717b775c059f274c36dcba0.tar.bz2
perlweeklychallenge-club-7054587111dc779ec717b775c059f274c36dcba0.zip
Add Perl solution
Diffstat (limited to 'challenge-179')
-rw-r--r--challenge-179/paulo-custodio/perl/ch-1.pl21
1 files 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);