Need help on Perl

Login or Register to Reply

Thread Tools Search this Thread
# 1  
Old 3 Weeks Ago
Need help on Perl

1. Write a perl Script to take any date value as input and find out and print how many days, months and year are remaining for that date.

2. Here Is my code:

use strict;
use warnings;
use feature 'say';

use Time::Piece;

print "date:\n";
chomp(my $date = <STDIN>);
print "mon:\n";
chomp(my $mon = <STDIN>);
print "year:\n";
chomp(my $year = <STDIN>);

my $tp = Time::Piece->strptime("$year-$mon-$date", '%Y-%m-%d');

say $tp->fullday;

3. My code's Output:

4. University Name: University Of Development Alternative

Moderator's Comments:
Mod Comment You're close, finally. Please also post the university's location, course title / number, and professor's / tutor's name.And, heed this advice: Get accustomed to reading carefully and thoroughly, be it assignments, comments, rules, help advice, etc. Would have helped you here to get answers in the first place, and will help you in your future studies.

Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 3 Weeks Ago at 04:01 AM.. Reason: Added CODE tags.
Login or Register to Reply

Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
PERL: In a perl-scripttTrying to execute another perl-script that SETS SOME VARIABLES ! alex_5161 Programming 1 03-03-2018 06:31 PM
Perl error : perl: warning: Setting locale failed. bobochacha29 AIX 1 10-17-2017 01:09 AM
Perl: restrict perl from automaticaly creating a hash branches on check alex_5161 Programming 2 11-08-2014 02:12 AM
Perl: How to load some functions automaticaly, starting Perl inteructively (with -d -e 0)? alex_5161 Programming 1 09-29-2014 04:05 PM
Perl :: reading values from Data Dumper reference in Perl scriptscript Shell Programming and Scripting 1 09-24-2013 01:22 PM
perl and HP-UX : instmodsh in combination with software depot : update inventory for installed Perl bora99 UNIX for Advanced & Expert Users 0 04-16-2012 11:25 AM
HELP on Perl array / sorting - trying to convert Korn Shell Script to Perl newbie_01 Shell Programming and Scripting 3 11-06-2011 01:26 AM
Hidden Characters in Regular Expression Matching Perl - Perl Newbie kittyluva2 Shell Programming and Scripting 4 07-28-2011 01:31 AM
Perl :How to print the o/p of a Perl script on console and redirecting same in log file @ same time. butterfly20 Shell Programming and Scripting 2 01-13-2011 07:35 AM
perl/unix: script in command line works but not in perl kpddong Shell Programming and Scripting 2 01-11-2011 01:27 PM
Perl - pass shell-vars into perl for input loop alex_5161 Shell Programming and Scripting 4 03-19-2010 02:11 PM
Passing date formats in Perl: i.e. Jul/10/2007 -> 20070710 (yyyymmdd) - Perl akil Shell Programming and Scripting 7 07-17-2009 09:09 AM
perl -write values in a file to @array in perl meghana Shell Programming and Scripting 27 06-07-2009 05:05 PM
[Perl] Accessing array elements within a sed command in Perl script userix Shell Programming and Scripting 2 10-03-2008 12:05 PM
[PERL] Running unix commands within Perl Scripts userix Shell Programming and Scripting 1 05-28-2008 06:06 PM