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.
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: golfing on localtime
by davorg
in thread golfing on localtime
by ForgotPasswordAgain
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |