I tried to convert a string to date in perl, but get error.
use strict;
use warnings;
use DateTime;
use Date::Manip;
my $date = ParseDate("20111121");
print "today is ".$date->day_of_week."\n";
error
Can't call method "day_of_week" without a package or object reference
Looks like the package import has problem …
Thanks
DateTime doesn’t parse dates. I’d go for the Time::Piece core module that gives you strptime():