in reply to golfing on localtime

perl -le 'print scalar localtime'

Or if you're pickier about the format:

perl -MPOSIX=strftime -le 'print strftime "%Y-%m-%d %H:%M:%S", localti +me'

Oh, and in your original code, print sprintf can be abbreviated to printf.

--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg