in reply to Dateless in Denver...

my $mdyt = `date '+%m/%d/%Y %H:%M:%S'`;
It displays correctly because the date command is outputting it to stdout, not because of "print $mdyt".

You could also say (a bit more efficient)

use POSIX; my $mdyt = strftime('+%m/%d/%Y %H:%M:%S', localtime(time));

Replies are listed 'Best First'.
Re^2: Dateless in Denver...
by jwkrahn (Abbot) on Aug 11, 2006 at 22:42 UTC
    The '+' character is how the date command recognizes the format, POSIX::strftime will just return a literal '+' character so:
    use POSIX 'strftime'; my $mdyt = strftime '%m/%d/%Y %H:%M:%S', localtime;