in reply to Get the date (MySQL style) for X days ago
You declared $date twice as a my variable. Try this:# "my" variable $date masks earlier declaration in same scope.
sub calcDate { my $offset = shift; my($mday, $mon, $year) = (localtime(time - $offset * 86400))[3..5]; return sprintf "%04s-%02s-%02s", $year + 1900, $mon + 1, $mday; }
|
|---|