Print Time – Perl

27 November 2008
by Billy Czajkowska

A key requirement for any log is to log the time and date of any action taking place in a script.  The command below will print the time to your log in a readable format
print LOG scalar localtime;
The output of this in a log will be as follows;
Thu Nov 27 14:48:48 2008
Note: (LOG) is the log file you adding or appending to.

Our Latest News