the year is 2004 the month is 03 the day is 04 2004 03 04 2004 03 03 #!/usr/bin/perl my $yr = `date -u +%Y`; #get the output of year my $mm = `date -u +%m`; #get the output of month my $dd = `date -u +%d`; #get the output of day my $yyyymmdd = `date -u +%Y%m%d`; print "the year is $yr"; print "the month is $mm"; print "the day is $dd"; $new_date = "$yr$mm$dd"; print $new_date; $yes_dd = $dd -1; $yes_dd = 0 . $yes_dd; $yes_date = $yr.$mm.$yes_dd; print "$yes_date\n";