-e is a switch that tells perl to execute the following command rather than reading a file and executing that. print is the same as in other languages, time() is a function that returns the number of seconds since midnight Jan 1, 1970 UTC, the period is the concatenation operator, and n is code for a newline character (which needs to be inside quotes so perl knows it’s part of a string. Since time() is a function it will not be interpreted if inside quotes, which is why they need be concatenated.
February 13th2009 at 3:31:30 (PST) was, by Unix time, 1234567890. There were parties and everything.
The value returned by that line can be used as input for a wide variety of functions in most programming languages. In Unix, the numeric value can be fed to the date command like so:
Gar
Unmatched ’
nope
perl -e 'print time() . "n"'
Does that help?
OK, I give up. What does this
OK, I give up. What does this mean? I don’t speak Perl, but that is weird syntax.….
Dad
-e is a switch that tells
-e is a switch that tells perl to execute the following command rather than reading a file and executing that. print is the same as in other languages, time() is a function that returns the number of seconds since midnight Jan 1, 1970 UTC, the period is the concatenation operator, and n is code for a newline character (which needs to be inside quotes so perl knows it’s part of a string. Since time() is a function it will not be interpreted if inside quotes, which is why they need be concatenated.
perl ‑e ‘print time() . “n“ ‘
How would you convert this back to a human readable format?
The value returned by that
The value returned by that line can be used as input for a wide variety of functions in most programming languages. In Unix, the numeric value can be fed to the date command like so:
date -jr 1267574003
Which returns:
Tue Mar 2 15:53:23 PST 2010
Or it can be done all on one line like so:
date -jr `perl -e 'print time() . "n"'`