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


in reply to String manipulation

Another way, borrowing Athanasius' alternation:
use warnings; use strict; while (<DATA>) { s/(\d+)(th|st|nd|rd)/$1/; print; } __DATA__ December 14th 2012 December 21st 2012 December 22nd 2012

See also: