$ perl -Mstrict -Mwarnings -E '
my $x = time; say $x;
my $y = int($x - (25*365.24225*24*60*60)); say $y;
my $z = (localtime($x-$y))[5]; say $z
'
1389999563
601076303
95
####
#!/usr/bin/env perl -l
use strict;
use warnings;
use Time::Piece;
use Time::Seconds;
my @YMDs = ([2004, 1, 17], [2004, 1, 18], [2004, 1, 19]);
my $now = localtime;
print 'Now: ', $now->strftime('%Y-%m-%d');
for (@YMDs) {
my $dob = Time::Piece->strptime(join('-' => @$_), '%Y-%m-%d');
print 'DOB: ', $dob->strftime('%Y-%m-%d');
print 'Age: ', int(($now->epoch - $dob->epoch) / ONE_YEAR);
}
####
Now: 2014-01-18
DOB: 2004-01-17
Age: 10
DOB: 2004-01-18
Age: 10
DOB: 2004-01-19
Age: 9