Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: English Date-Suffixes

by petral (Curate)
on Nov 07, 2002 at 15:43 UTC ( #211093=note: print w/ replies, xml ) Need Help??

in reply to English Date-Suffixes

And qw(0 st nd rd)[pop=~/(1?.)$/]or"th"
will do any integer.

Note that for pre-5.6 perl you have to do (qw(...))[index]
because qw was translated into  split' ','...' during compilation.


Comment on Re: English Date-Suffixes
Select or Download Code
Replies are listed 'Best First'.
Re: Re: English Date-Suffixes
by mtve (Chaplain) on Nov 10, 2002 at 09:36 UTC

    small improvement:

      Wow, didn't know about dropping the qw!
      Why does the ||th  lead to only returning the last value from the /1?./g -indexed list?

      Update:  I see, it becomes a comma list which returns the last value ("the result of the last expression").
      see, A list returns its last, an array returns its weight


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://211093]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2015-11-27 20:34 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (731 votes), past polls