Getting Time in MilliSeconds with Perl

I use something like this in perl to get the date and time:

use Time::localtime;
use Time::gmtime;
$tm = gmtime;
$time_str = sprintf "%04d-%02d-%02d %02d:%02d:%02d",
$tm->year + 1900, $tm->mon + 1, $tm->mday,
$tm->hour, $tm->min, $tm->sec;

It gives me something like this:

2010-08-26 06:50:55

I actually want the time down to the millisecond level. So I want something like:

2010-08-26 06:50:55.23

Any idea how I would get this?

Use the Time::HiRes Perl module to determine the time up to the nearest microsecond.

Time::HiRes - search.cpan.org

tyler_durden