Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Getting the date in the round-about way

Expand Messages
  • gaijin_punch
    Hey guys: Thanks for the input. There was many references to localtime in the book, but I guess I overlooked a few things. The way I did it was mainly b/c I
    Message 1 of 5 , Aug 4 5:12 PM
    • 0 Attachment
      Hey guys:

      Thanks for the input. There was many references to localtime in the
      book, but I guess I overlooked a few things. The way I did it was
      mainly b/c I used to do something similar w/ bash, and I knew it'd
      work, so didnt' bother w/ the other ways. :)

      However, I've duly noted for future reference.

      Ciao

      > And I HIGHLY doubt you are "running the system 'data' command" and
      getting
      > its output in $_. system() doesn't RETURN output.

      open ( DATE, "date|") or die "Can't run date command $!";
      while ( <DATE> ) {
      chomp;
      print "$_\n";
      }

      yields:
      Tue Aug 5 09:11:15 JST 2003
      Don't know what else to tell ya. :)
    • Jeff 'japhy' Pinyan
      ... You made it sound like you were doing: $date = system date ; which does NOT return the information into $date that you expect. I see you re using open(),
      Message 2 of 5 , Aug 4 7:26 PM
      • 0 Attachment
        On Aug 5, gaijin_punch said:

        >Thanks for the input. There was many references to localtime in the
        >book, but I guess I overlooked a few things. The way I did it was
        >mainly b/c I used to do something similar w/ bash, and I knew it'd
        >work, so didnt' bother w/ the other ways. :)

        >> And I HIGHLY doubt you are "running the system 'data' command" and
        >getting
        >> its output in $_. system() doesn't RETURN output.
        >
        >open ( DATE, "date|") or die "Can't run date command $!";
        >while ( <DATE> ) {
        > chomp;
        > print "$_\n";
        >}
        >
        >yields:
        >Tue Aug 5 09:11:15 JST 2003
        >Don't know what else to tell ya. :)

        You made it sound like you were doing:

        $date = system 'date';

        which does NOT return the information into $date that you expect. I see
        you're using open(), which will return the stuff you want, but it's still
        inferior and not portable; localtime() is the way to go.

        --
        Jeff "japhy" Pinyan japhy@... http://www.pobox.com/~japhy/
        RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
        <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
        [ I'm looking for programming work. If you like my work, let me know. ]
      Your message has been successfully submitted and would be delivered to recipients shortly.