Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > what is $date means?

Reply
Thread Tools

what is $date means?

 
 
yezi
Guest
Posts: n/a
 
      08-03-2005
Dear all:

The following code is like this:
# the sendmail binary.
$sendmail = "/usr/lib/sendmail";


# base of your httpd installation.
$basedir = '/www';
# log file
$logfile = "$basedir/etc/logs/$progname.log";


# today
$date = `date`;
print " $logfile $date";


suppose the output to the screen is :

/www/etc/logs/progra.log date

however the outpur is /www/etc/logs/progra.log Wed Aug 3 17:29:06
MDT 2005


that means the $date is current date but not a string , right? $date is
kind of reserved variable?
Thanks for any comments






 
Reply With Quote
 
 
 
 
John Bokma
Guest
Posts: n/a
 
      08-03-2005
"yezi" <(E-Mail Removed)> wrote:

> Dear all:
>
> The following code is like this:
> # the sendmail binary.
> $sendmail = "/usr/lib/sendmail";
>
>
> # base of your httpd installation.
> $basedir = '/www';
> # log file
> $logfile = "$basedir/etc/logs/$progname.log";
>
>
> # today
> $date = `date`;
> print " $logfile $date";
>
>
> suppose the output to the screen is :
>
> /www/etc/logs/progra.log date
>
> however the outpur is /www/etc/logs/progra.log Wed Aug 3 17:29:06
> MDT 2005
>
>
> that means the $date is current date but not a string , right?


wrong

> $date is
> kind of reserved variable?


no

It gets its value from `date`. Look up what back ticks do in Perl.

--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html

 
Reply With Quote
 
 
 
 
yezi
Guest
Posts: n/a
 
      08-04-2005
It means the date is some function and get the information of date and
send the value to $date, right?
$date = `date`, so even the date is quoted,but is not a string.
right?


John Bokma wrote:
> "yezi" <(E-Mail Removed)> wrote:
>
> > Dear all:
> >
> > The following code is like this:
> > # the sendmail binary.
> > $sendmail = "/usr/lib/sendmail";
> >
> >
> > # base of your httpd installation.
> > $basedir = '/www';
> > # log file
> > $logfile = "$basedir/etc/logs/$progname.log";
> >
> >
> > # today
> > $date = `date`;
> > print " $logfile $date";
> >
> >
> > suppose the output to the screen is :
> >
> > /www/etc/logs/progra.log date
> >
> > however the outpur is /www/etc/logs/progra.log Wed Aug 3 17:29:06
> > MDT 2005
> >
> >
> > that means the $date is current date but not a string , right?

>
> wrong
>
> > $date is
> > kind of reserved variable?

>
> no
>
> It gets its value from `date`. Look up what back ticks do in Perl.
>
> --
> John Small Perl scripts: http://johnbokma.com/perl/
> Perl programmer available: http://castleamber.com/
> Happy Customers: http://castleamber.com/testimonials.html


 
Reply With Quote
 
Tony Curtis
Guest
Posts: n/a
 
      08-04-2005

[ top-posting rearranged ]

>> On 3 Aug 2005 17:02:03 -0700,
>> "yezi" <(E-Mail Removed)> said:


> John Bokma wrote:
>> "yezi" <(E-Mail Removed)> wrote:
>>
>> > Dear all:
>> >
>> > The following code is like this: > # the sendmail binary.
>> > $sendmail = "/usr/lib/sendmail";
>> >
>> >
>> > # base of your httpd installation. > $basedir = '/www';
>> > # log file > $logfile =

>> "$basedir/etc/logs/$progname.log";
>> >
>> >
>> > # today > $date = `date`; > print " $logfile $date";
>> >
>> >
>> > suppose the output to the screen is :
>> >
>> > /www/etc/logs/progra.log date
>> >
>> > however the outpur is /www/etc/logs/progra.log Wed Aug 3

>> 17:29:06 > MDT 2005
>> >
>> >
>> > that means the $date is current date but not a string ,

>> right?
>>
>> wrong
>>
>> > $date is > kind of reserved variable?

>>
>> no
>>
>> It gets its value from `date`. Look up what back ticks do
>> in Perl.


> It means the date is some function and get the information
> of date and send the value to $date, right? $date = `date`,
> so even the date is quoted,but is not a string. right?


Nope, on both counts.

So if not a string, what do you think $date is?

hth
t
 
Reply With Quote
 
John Bokma
Guest
Posts: n/a
 
      08-04-2005
"yezi" <(E-Mail Removed)> wrote:

> It means


What? Please don't top post. This is a technical group, learn how it works
before you abuse it.

> the date is some function


No

> and get the information of date and
> send the value to $date, right?
> $date = `date`, so even the date is quoted,but is not a string.
> right?


No

Do what I suggested before: read the documentation. You can't program by
just guessing what things do.

--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments