Chris,
I appreciate you responding to my message, but I don't understand some of
the
issues you were speaking about.

"you want to use backticks " I do not understand what you mean by this?
Where should I be using them? In place of what?

I understood the incorrect use of the binding operator.

As I included in the original message, when attempting to print to the
datafile,

 $time =~ system('TIME \/T');
 $date =~ system('DATE \/T');
 print DATAFILE "\n$time $date";

This did not work, so I removed the filehandle and put the 3 lines in it's
own program to test it to make
sure that it would print the date and time to the console.

 $time =~ system('TIME \/T');
 $date =~ system('DATE \/T');
 print "\n$time $date";

That worked. I am not sure that I understand your point.
Thanks for your patience,

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

----- Original Message -----
From: "Chas Owens" <[EMAIL PROTECTED]>
To: "Craig S Monroe" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, June 13, 2001 11:40 AM
Subject: Re: Problem printing a system value to a filehandle (windows)


> 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!
>
>

Reply via email to