{ my @thsuffix = (qw(th st nd rd), (th) x 6); sub th { my $n = shift; return $n. (($n > 9 and $n < 14) ? 'th' : $thsuffix[substr($n,-1)]); } }