in reply to String manipulation

Assuming this is homework and you really want to surprise your teacher:
use Modern::Perl; use Date::Parse; use DateTime; while (<DATA>) { my $dt = DateTime->from_epoch( epoch => str2time($_, '+0000')); say join ' ', $dt->month_name(), $dt->day(), $dt->year(); } __DATA__ December 14th 2012 December 21st 2012 December 22nd 2012
Output:
December 14 2012 December 21 2012 December 22 2012

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics

Replies are listed 'Best First'.
Re^2: String manipulation
by BillKSmith (Monsignor) on Dec 15, 2012 at 15:41 UTC
    Treating the data as a date rather than a generic string can have a huge advantage in avoiding unwanted changes.
    Bill