Wednesday, April 10, 2013

Perl - 6 examples to fetch date / time without Linux date command

How to fetch date and time related stuff within in Perl?
   Sometimes, Perl developers resort to using of Unix system date command to fetch a date or time within Perl script. This is not needed at all since Perl itself has a set of built-ins using which dates and epoch can be retrieved easily without using the system date command. In this article, let us see how to simulate the date related commands in Perl.

1. Getting the date command output:
Linux command:
$ date
To get the date command like output in Perl: