in reply to storing date into variable

That's because $todayDate is empty, system doesn't capture the output of the command.

But a better way to get the current is the built-in function localtime.

Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^2: storing date into variable
by ack (Deacon) on Nov 11, 2009 at 16:14 UTC

    Curious.

    When I run the OP's code (as I noted in my response to Corion's OP response), I do get information returned from system() that gets stored into $todayDate. It's just not at all what the OP seems to think (based upon the OP's code).

    Of course as I also noted in my response to Corion, it may be because I'm working in Windows. On my windows box, system() does return a result...but maybe not on Unix or Unix-like systems. I rarely work on Unix systems so I'm not that familiar with how system() works on them.

    ack Albuquerque, NM
      I never said that system doesn't return a result (it does indeed, and it's well documented), just that it doesn't capture the output.
      Perl 6 - links to (nearly) everything that is Perl 6.