#!/usr/bin/perl use warnings; use strict; use POSIX qw(strftime); my $calc_days; if ( ! @ARGV ) { print "Please enter number of days (+/-): "; $calc_days = ; chomp $calc_days; exit 1 if $calc_days eq ''; } else { $calc_days = $ARGV[0]; } # Convert days to seconds; my $secs = $calc_days * 24 * 60 * 60; # Convert seconds to a readable format, adding them to the current time my $final_date = strftime ('%d/%m/%Y %T', localtime(time() + $secs)); print "$final_date\n";