1 #!/usr/bin/perl -w
2 # File: date_ex.pl
3 # Author: Tom Large - tlarge@thelug.org
4 # Location: http://www.thelug.org/docs/
5 # Description: Simple script to echo the date for
6 # today and yesterday.
7
8 # Get today's info out of epoch.
9 $zero_day = localtime(time);
10 my ($day, $month, $mday, $clock, $year) = split(/\s\s?/, $zero_day);
11
12 # Get yesterday's info by subtracting one day of seconds from epoch.
13 $one_epoch = (time - 86400);
14 $one_epoch = localtime($one_epoch);
15 my ($one_day, $one_month, $one_mday, $one_clock, $one_year) = split(/\s\s?/, $one_epoch);
16
17 $today = "$month\/$mday\/$year";
18 $yesterday = "$one_month\/$one_mday\/$one_year";
19
20 print "$today\n$yesterday\n";
syntax highlighted by Code2HTML, v. 0.9.1