in reply to Calling Windows "time /t" command

Hi JFarr,

The problem is that the "time /t" command is a Windows command.  You can't use it to get the time on a Linux/Unix system.

However, you can use Perl's time function to get the current time (specified in seconds since the epoch), which will work on any system.  Then, use localtime to return the time in a readable format:

#!/usr/bin/perl -w use strict; use warnings; my $time = time; my $timestr = localtime($time); print "Current date/time is $timestr\n";

Oh, and one further note ... you can't assign a variable to the results from a system call.  If you really wanted to assign a variable, say $x, to the results of the time /t system call in Windows, you would use the backtick "`" operator (and then likely chomp to remove the newline):

my $x = `time /t`; # Assign $x to the system time (only in Windows) chomp $x; # $x now holds something like "10:51 AM"

s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/