-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 13th 2009 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:
The American Dream is that dream of a land in which life should be better and richer and fuller for everyone, with opportunity for each according to ability or achievement. It is a difficult dream for the European upper classes to interpret adequately, and too many of us ourselves have grown weary and mistrustful of it. It is not a dream of motor cars and high wages merely, but a dream of social order in which each man and each woman shall be able to attain to the fullest stature of which they are innately capable, and be recognized by others for what they are, regardless of the fortuitous circumstances of birth or position.
Comments
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 1267574003Which returns:
Tue Mar 2 15:53:23 PST 2010Or it can be done all on one line like so:
date -jr `perl -e 'print time() . "\n"'`Post new comment