http://www.perlmonks.org?node_id=515355


in reply to What one-liners do people actually use?

Over the years I've found that I'm far too lazy to keep typing one liners so they usually end up as a tiny script in my $HOME/bin. I found myself typing the following one liner this week and because of its length, it immediately became $HOME/bin/sectostr.

perl -e 'use POSIX qw(strftime);print strftime("%H:%M:%S\n",974,0,0,0, +0,0);'

-- vek --

Replies are listed 'Best First'.
Re^2: What one-liners do people actually use?
by Anonymous Monk on Dec 10, 2005 at 22:31 UTC
    Another way to write that:
    perl -e'printf "%3\$02d:%2\$02d:%1\$02d\n", gmtime 974' :-)