my $err; local *STDERR; open STDERR, '>', \$err; use Time::Piece; $time = Time::Piece->strptime('2005-02-24 23:000', "%Y-%m-%d %H:%S");