1 #!/usr/bin/perl -w
2 # File: month_converter.pl
3 # Author: Tom Large - tlarge@thelug.org
4 # Location: http://www.thelug.org/docs/
5 # Description: Acquire the current date and time from localtime.
6 # Based on that information, manipulate it to a different format.
7 # This is mainly useful for finding log files.
8
9 my ($wday, $mon, $mday, $clock, $year) = split(/\s/, localtime);
10
11 my %mon_num = (
12 "Jan" => "01", "Feb" => "02", "Mar" => "03",
13 "Apr" => "04", "May" => "05", "Jun" => "06",
14 "Jul" => "07", "Aug" => "08", "Sep" => "09",
15 "Oct" => "10", "Nov" => "11", "Dec" => "12");
16
17 print "$mon_num{$mon}$mday$year\n";
syntax highlighted by Code2HTML, v. 0.9.1