Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
15
Task/Nth/Perl/nth-1.pl
Normal file
15
Task/Nth/Perl/nth-1.pl
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
my %irregulars = ( 1 => 'st',
|
||||
2 => 'nd',
|
||||
3 => 'rd',
|
||||
11 => 'th',
|
||||
12 => 'th',
|
||||
13 => 'th');
|
||||
sub nth
|
||||
{
|
||||
my $n = shift;
|
||||
$n . # q(') . # Uncomment this to add apostrophes to output
|
||||
($irregulars{$n % 100} // $irregulars{$n % 10} // 'th');
|
||||
}
|
||||
|
||||
sub range { join ' ', map { nth($_) } @{$_[0]} }
|
||||
print range($_), "\n" for ([0..25], [250..265], [1000..1025]);
|
||||
4
Task/Nth/Perl/nth-2.pl
Normal file
4
Task/Nth/Perl/nth-2.pl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
use Lingua::EN::Numbers::Ordinate 'ordinate';
|
||||
foreach my $i (0..25, 250..265, 1000..1025) {
|
||||
print ordinate($i),"\n";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue