Help for this page

Select Code to Download


  1. or download this
    sub num2ord {
      my $n = shift;
    ...
    # 12345678901234678901234567890123456789012345678901234567890123456789
    +0
      $n.($n=~/1.$/?'th':qw(th st nd rd)[$n=~/([123]?)$/])
    }
    
  2. or download this
    sub num2ord {
      my $n = shift;
    ...
    # 12345678901234678901234567890123456789012345678901234567890123456789
    +0
      $n.(qw(th st nd rd)[$n=~/(1?\d)$/]||th)
    }