package Template::Plugin::datecalc; use base qw(Template::Plugin); sub new { return bless {}, $_[0]} sub day_of_month { (localtime(time))[3] } sub suffix { my $day = pop; return "st" if ($day==1 || $day==21 || $day==31); return "nd" if ($day==2 || $day==22); return "rd" if ($day==3 || $day==23); "th" } 1;