I just tried the OP's code and indeed it doesn't do at all what the OP seems to think it does. I am running on Windows Vist so that could effect it; it seems that very many of the system() calls that work on Unix and Unix-like systems don't work like (or at all) on Windows. So that might be a part of what I'm seeing. On windows the
my $todayDate = system qq(date)
ends up opening a command window and holds until you release the window (close it or exit from it) and then, when I print $todayDate I get a fairly long string that says: The current date is: 11/11/2009
Enter the new date: (mm-dd-yy) $todayDate
So, as Corion noted, when it is split the various variables that the OP assigned to do not, at all, have what the OP seems to think. Using the Perl "localtime" or "gmtime" in a way similar to:
my($sec,$min,$hr,$day,$month,$yr) = (localtime())[0..5];
or,
my($sec,$min,$hr,$day,$month,$yr) = (gmtime())[0..5];
depending upon whether the local or gmt time is wanted, should work much better and it works on both Unix, Unix-like, and Windows systems just fine. Just my humble opinion.
|