what is $date means?

Discussion in 'Perl Misc' started by yezi, Aug 4, 2005.

  1. yezi

    yezi Guest

    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
    yezi, Aug 4, 2005
    #1
    1. Advertising

  2. yezi

    John Bokma Guest

    "yezi" <> 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
    John Bokma, Aug 4, 2005
    #2
    1. Advertising

  3. yezi

    yezi Guest

    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" <> 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
    yezi, Aug 4, 2005
    #3
  4. yezi

    Tony Curtis Guest

    [ top-posting rearranged ]

    >> On 3 Aug 2005 17:02:03 -0700,
    >> "yezi" <> said:


    > John Bokma wrote:
    >> "yezi" <> 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
    Tony Curtis, Aug 4, 2005
    #4
  5. yezi

    John Bokma Guest

    "yezi" <> 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
    John Bokma, Aug 4, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    1
    Views:
    597
    Matthew Speed
    Nov 8, 2003
  2. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,250
    Michael Borgwardt
    May 30, 2004
  3. Matt
    Replies:
    2
    Views:
    514
    Pete Becker
    Nov 8, 2003
  4. Matt
    Replies:
    3
    Views:
    719
    Richard Heathfield
    Nov 8, 2003
  5. Matt
    Replies:
    11
    Views:
    405
    Aaron Bertrand [MVP]
    Nov 8, 2003
Loading...

Share This Page