http://www.perlmonks.org?node_id=211744


in reply to Re: English Date-Suffixes
in thread English Date-Suffixes

small improvement:

(0,st,nd,rd)[pop=~/1?./g]||th

Replies are listed 'Best First'.
Re: Re: Re: English Date-Suffixes
by petral (Curate) on Nov 12, 2002 at 20:07 UTC
    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

      p