in reply to Morning or Night?

If all you're trying to do is print the current time with "AM" or "PM" attached to the date then you can try this ridiculously simple example (caveat: only works for UNIX or Cygwin on Windows).

#!/usr/local/bin/perl -w
use strict;

print `date +"%D %P"`;

Prints out the following:

01/12/02 am

metadoktor

"The doktor is in."

Replies are listed 'Best First'.
Re: Re: Morning or Night?
by blakem (Monsignor) on Jan 12, 2002 at 16:29 UTC
    Or better yet, avoid forking `date` by using core perl to do the same thing...
    #!/usr/bin/perl -wT use strict; use POSIX qw(strftime); print strftime("%D %P",localtime);

    -Blake