On 13 Jun 2001 10:49:44 -0400, Craig S Monroe wrote:
> Hello all,
>
> I have a script that opens a socket to a device, issues some commands,
> then writes the results to a datafile.
> That all works fine. I decided that I wanted to time stamp each of the
> entries
>
> So where I put my separator:
>
> # print a section separator to the dateFile
> print DATAFILE
> "\n\n===================================================================
> ==========\n\n";
>
> I wanted to put the date below it.
>
> $time =~ system('TIME \/T');
> $date =~ system('DATE \/T');
There are two things wrong here. First system returns the exit code of
the process you call (not the output), you want to use backticks (shift
~ on most keyboards in the US). Second =~ is the binding operator for
regexps not the assignment operator. You should be saying:
$time = `TIME /T`;
$date = `DATE /T`;
> print DATAFILE "\n$time $date";
>
> It would not append the time and date.
> So, I used the above to make it it's own perl script, and just removed
> the filehandle so the output would print to the console.
>
> $time =~ system('TIME \/T');
> $date =~ system('DATE \/T');
> print "\n$time $date";
>
> This printed the date and the time to the console.
> Does anyone have any suggestions as to why this is not working?
It is working exactly as you told it to work <grin />. It is running
the TIME command (which outputs the time to stdout) and then running the
DATE command (which outputs the date to stdout).
>
> Thank you,
>
> Craig
> [EMAIL PROTECTED]
> Pager
> Numeric: 1-877-895-3558
> Email pager: [EMAIL PROTECTED]
> --------------------------------------------------------------
> You will never find time for anything.
> If you want time, you must make it.
>
> Charles Buxton
>
--
Today is Prickle-Prickle, the 18th day of Confusion in the YOLD 3167
Grudnuk demand sustenance!