I added strict/warnings to your code:
use strict; use warnings; use Time::Piece; use Time::Seconds; my $before = Time::Piece->strptime("2001/01/01", "%Y/%m/%d"); my $now = localtime; my $diff = $now - $before; print int($diff->days), " days since $before\n";
Which produced:
4861 days since Mon Jan 1 00:00:00 2001
Which is correct. Did you copy and paste your actual code?
In reply to Re: Time:Piece help
by marto
in thread Time:Piece help
by sauravrout
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |