[url=http://perldoc.perl.org/functions/use.html][black][b]use[/b][/black][/url] [green]Time::Local[/green] [red]'[/red][purple]timelocal_nocheck[/purple][red]'[/red][red];[/red]
[gray][i]# An array to hold the names of each day of the week. [/i][/gray]
[url=http://perldoc.perl.org/functions/my.html][black][b]my[/b][/black][/url] [blue]@weekday[/blue] = [red]qw([/red][purple]Sunday Monday Tuesday Wednesday Thursday Friday Saturday[/purple][red])[/red][red];[/red]
[gray][i]# '09-11-2001' can be a parameter/argument you pass to the script[/i][/gray]
[black][b]my[/b][/black] [blue]$mm_dd_yyyy[/blue] = [red]'[/red][purple]09-11-2001[/purple][red]'[/red][red];[/red]
[black][b]my[/b][/black] [blue]$day_of_week[/blue] = [maroon]get_day[/maroon][red]([/red][blue]$mm_dd_yyyy[/blue][red])[/red][red];[/red]
[url=http://perldoc.perl.org/functions/print.html][black][b]print[/b][/black][/url] [red]"[/red][purple][blue]$mm_dd_yyyy[/blue] was a [blue]$day_of_week[/blue][/purple][red]"[/red][red];[/red]
[url=http://perldoc.perl.org/functions/sub.html][black][b]sub[/b][/black][/url] [maroon]get_day[/maroon] [red]{[/red]
[black][b]my[/b][/black] [blue]$date[/blue] = [url=http://perldoc.perl.org/functions/shift.html][black][b]shift[/b][/black][/url] || [url=http://perldoc.perl.org/functions/return.html][black][b]return[/b][/black][/url][red]([/red][fuchsia]0[/fuchsia][red])[/red][red];[/red]
[black][b]my[/b][/black] [red]([/red][blue]$mon[/blue],[blue]$mday[/blue],[blue]$year[/blue][red])[/red] = [blue]$date[/blue] =~ [red]/[/red][purple]([purple][b]\d[/b][/purple]+)-([purple][b]\d[/b][/purple]+)-([purple][b]\d[/b][/purple]+)[/purple][red]/[/red][red];[/red]
[black][b]my[/b][/black] [blue]$epochtime[/blue] = [maroon]timelocal_nocheck[/maroon][red]([/red][fuchsia]0[/fuchsia], [fuchsia]0[/fuchsia], [fuchsia]0[/fuchsia], [blue]$mday[/blue], [blue]$mon[/blue]-[fuchsia]1[/fuchsia], [blue]$year[/blue][red])[/red][red];[/red]
[black][b]my[/b][/black] [blue]$day[/blue] = [red]([/red][url=http://perldoc.perl.org/functions/localtime.html][black][b]localtime[/b][/black][/url][red]([/red][blue]$epochtime[/blue][red])[/red][red])[/red][red][[/red][fuchsia]6[/fuchsia][red]][/red][red];[/red]
[black][b]return[/b][/black] [blue]$weekday[/blue][red][[/red][blue]$day[/blue][red]][/red][red];[/red]
[red]}[/red]