How to add or subtract ‘n’ number of days from current date in Perl?

We can add or subtract ‘n’ number of days from current date in Perl using the most prominent date module POSIX. It can be done as follows.

#!/usr/bin/perl -w
use POSIX;
my $current_date=strftime "%m/%d/%Y", localtime; # let it be 02/17/2016
my $today = time;
my $lastweek = $today - 7 * 24 * 60 * 60; # current date - 7 days
my $lastweek_date=strftime "%m/%d/%Y", localtime($lastweek);
my $nextweek = $today + 7 * 24 * 60 * 60; # current date + 7 days
my $nextweek_date=strftime "%m/%d/%Y", localtime($nextweek);
print qq{Current Date = }.$current_date."\n";
print qq{Current Date - 7 Days = }.$lastweek_date."\n";
print qq{Current Date + 7 Days = }.$nextweek_date."\n";

Output :

Current Date =  02/17/2016
Current Date - 7 Days = 02/10/2016
Current Date + 7 Days = 02/24/2016