develooper Front page | perl.perl5.porters | Postings from March 2000

Re: [ID 20000307.005] Date Problem

Russ Allbery
March 7, 2000 09:54
Re: [ID 20000307.005] Date Problem
Message ID:
Jeff Pinyan <> writes:

> Oh, and if you want the string "th" to follow the $day variable, then
> you can do something like

>   print "... the ${day}th of $month";

Or, more accurately:

# The endings for ordinal numbers.
@ORDINALS = ('th', 'st', 'nd', 'rd', ('th') x 17, 'st', 'nd', 'rd',
             ('th') x 7, 'st');

print "... the $day$ORDINALS[$day] of $month";

But this is getting off-topic.  :)

Russ Allbery (             <> Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About