#!/usr/bin/perl use strict; use warnings; my $date_cmd = '/bin/date'; my $date_format = q{ "+%Y-%m-%d %H:%M:%S %Z" }; # See date(1), strftime(3) chomp(my $date = qx{ ${date_cmd} ${date_format} } ); print "${date}\n";