#!/usr/bin/perl use warnings; use strict; # Without the brackets, too many functions would be exported # into the main::-namespace: use POSIX (); # Print current time in central European format including seconds: print POSIX::strftime("%H:%M:%S", localtime) . "\n"; # On Linux, you can read more about format-strings like "%H:%M:%S" # by executing the shell-command "info date". # Print today's date in central European format; the numbers of days and months # below 10 are zero-padded (like in 09.08.2007): print POSIX::strftime("%d.%m.%Y", localtime) . "\n"; # Print seconds since epoch (on Linux, epoch is 1.1.1970): print time . "\n"; # Generate a time-list from seconds since epoch and print it: my @tml = localtime; print join(", ", @tml) . "\n"; # Print today's date in central European format using the time-list generated above; # the numbers of days and months below 10 are blank-padded (like in 9.8.2007): print $tml[3] . "." . ($tml[4] + 1) . "." . ($tml[5] + 1900) . "\n"; # Convert the time-tuple back to seconds since epoch: print POSIX::mktime(@tml) . "\n";