I have a task in perl in which I need to execute 'some_code' but only if date is older than 24 hours counting from now. I'm trying the below code but it doesn't seems to be working.
sub function {
use Date::Manip::Date
use Date::Parse
use Date::Format;
my $yesterday = time() - 60*60*24;
my $x = shift;
my $env = shift;
$env->{some_code} = 1 if $x < $yesterday;
return $x;
}
You can do it easily, only using core functions.
Output: