#!/usr/bin/perl use warnings; use strict; use Date::Calc qw/Time_to_Date Delta_YMDHMS Delta_DHMS Today_and_Now/; my ( $year, $month, $day, $hour, $min, $sec ) = Today_and_Now(); my ( $end_year, $end_month, $end_day, $end_hour, $end_min, $end_sec ) = ( 2004, 4, 1, 0, 0, 0 ); my @cached_today_and_now = Today_and_Now; print "Today_and_Now value: ", join('-', @cached_today_and_now), "\n"; print "End time value: 2004-4-1-0-0-0\n\n"; print 'Function |', join ( '|', map { sprintf( "%-5s", $_ ) } qw/Yrs Mons Hrs Days Mins Secs/ ), "\n"; print "-" x 49, "\n"; # The two N/As are added in to pad the results of Delta_DHMS, as it # returns two fewer values and I wanted the table to line up neatly print 'Delta_DHMS |', join ('|', (' N/A', ' N/A', map { sprintf( "%5d", $_ ) } Delta_DHMS( @cached_today_and_now, 2004, 4, 1, 0, 0, 0 ))), "\n"; print 'Delta_YMDHMS |', join ( '|', map { sprintf( "%5d", $_ ) } Delta_YMDHMS( @cached_today_and_now, 2004, 4, 1, 0, 0, 0 ) ), "\n";