Stupid trick to make it do the magic Rafael expected:
#!/usr/bin/perl
use warnings;
use strict;
{
package Tied_Strftime;
sub TIESCALAR {
my($class, $fmt) = @_;
return bless(\$fmt, $class);
}
sub FETCH {
use DateTime;
Rafael Morales wrote:
>Why the seconds and milliseconds do not change ?? How can I do it to
>work fine ???
Your program looks up the current time once, at the start. It then
repeatedly prints out that one time. $time never changes. You want to
move the call to time() inside the loop, so tha
Hi list:
I have this:
#!/usr/bin/perl
use strict;
use warnings;
use DateTime;
use Time::HiRes qw( time );
my $dt = DateTime->from_epoch( epoch => time() );
my $time = $dt->strftime( '%Y-%m-%d %H:%M:%S.%3N' );
while ( $time ) {
print "$time\n";
}
And this is this the outpu:
2006-11-28