http://www.perlmonks.org?node_id=1047654


in reply to Date function

It looks like you can display the current date and time. You just need to subtract 24 hours from now to get to yesterday.
localtime( time() - (24 * 60 * 60) );
Combine that with strftime() and youre done.

EDIT (after comment below): Make sure your timezone is set correctly too.

Replies are listed 'Best First'.
Re^2: Date function
by tobyink (Canon) on Aug 03, 2013 at 14:54 UTC

    A reasonable approach, though if you live somewhere that observes daylight savings, it will produce incorrect results for one hour, twice each year.

    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name