Date and Time Manipulations

Get epoch mtime of file
perl -le '@pv=stat("somefile"); printf "%d\n", $pv[9];'
perl -e 'print scalar((stat(shift))[9])."\n";' somefile

Get epoch of date (sec, min, hour, day, month-1, year)
perl -e 'use Time::Local; print timelocal(34,59,9,9,11,2014)."\n";'

Get fancy date from epoch
perl -e 'use POSIX "strftime"; print strftime("%Y-%m-%d %H:%M:%S",localtime(1418115574))."\n";'
perl -e 'use POSIX "strftime"; print strftime("%Y-%m-%d %H:%M:%S",localtime(@ARGV[0]))."\n";' ${some_var}
perl -e 'use POSIX "strftime"; print strftime("%Y-%m-%d %H:%M:%S",localtime(shift))."\n";' ${some_var}

Get Start time of a process
perl -e 'open (PSINFO, shift); read (PSINFO, $Psinfo, 448); printf STDOUT "%d\n", (unpack ("L42a16a80L16L7C4ILA8I2L16", $Psinfo))[29];' /proc/$pid/psinfo

To be continued...




Not Perl: Benford's law

Also not perl: setting the terminal title:
print -n "\033]0;$(hostname -s)\007"