Q:

How do I get last year date and current date using perl? 

I want to fetch current date and exactly last year date using perl in the format of 140220 and 130220. 

A:

Perhaps the following will help:
use strict;
use warnings;
use Time::Piece;

my $time     = Time::Piece->new;
my $currDate = $time->strftime('%y%m%d');
print $currDate, "\n";

my $lastYear = $time->add_years(-1)->strftime('%y%m%d');
print $lastYear;

Output:
140219
130219

A:

Here is a sample using DateTime. 
#! /usr/bin/env perl

use strict;
use warnings;
use feature qw/say/;
use DateTime;

my $dt = DateTime->now();
my $year_ago = DateTime->now()->subtract(years => 1);

say $dt->strftime("%y%m%d");
say $year_ago->strftime("%y%m%d");

