#!/usr/bin/perl
use strict;
use warnings;
use Time::Local;
use POSIX 'strftime';
my $date = shift || die "No date given\n\n\tUsage: ./test.pl 2017-07-17, please note the format, CCYY-MM-DD\n\n";
my @date = split /-/, $date;
$date[0] -= 1900;
$date[1]--;
die "Invalid date: $date\n" unless @date == 3;
my $now = &timelocal(0, 0, 12, reverse @date);
do{
$now += 24 * 60 * 60;
#}while ((strftime('%u', localtime $now) != 1) && (strftime('%u', localtime $now) != 5) && (strftime('%u', localtime $now) != 3)); ## For Multiple days, in case you want to find either, next monday, friday or wednesday
}while (&strftime('%u', localtime $now) != 1); #Values should be from 1 to 7, including...
my @array_of_time = localtime($now);
my $formatted_time = &strftime( "%Y%m%d", @array_of_time );
print ("Next Monday-[$formatted_time]\n");