title: Perl get date before to ten days of particular date
body: <p>I need to get a date which is 10 days before to the inputted date.</p>
  
  <p>Here is my script - ( Ref. taken from Dave's <a href="https://stackoverflow.com/a/56125332/6124824">answer</a> )</p>
  
  <pre><code>#!/usr/bin/perl
  
  use strict;
  use warnings;
  
  use Time::Local;
  use POSIX 'strftime';
  
  my $DATE = $ARGV[0];
  ( $DATE =~ /(....)(..)(..)/ );
  
  my ($day, $mon, $yr) = ( $3, $2, $1 );
  
  my $midday = timelocal(0, 0, 12, $day, $mon, $yr); 
  
  my $midday_before = $midday - (10 * 24 * 60 * 60);
  
  my $required_date = strftime('%Y-%m-%d', localtime($midday_before));
  
  print "10 days to before ".$yr."-".$mon."-".$day." is : $required_date\n";
  
  </code></pre>
  
  <p>But my output looks like this, which I am confused:</p>
  
  <pre><code>$ perl get_date.pl 20200527
  10 days to before 2020-05-27 is : 2020-06-17
  </code></pre>
  
  <p>I am expecting <code>2020-05-17</code>. But its giving me <code>2020-06-17</code> which is 20 days ahead of my inputted date.</p>
  
  <p>I don't want to use <code>DateTime</code> to achieve this. Since there is a permission issue in installing the modules.</p>