Code snippits : perl date stamp for adding to file

#!/usr/local/bin/perl

my @lt = localtime(time);
my $dte = sprintf “%04d%02d%02d%02d%02d%02d”, $lt[+5]+1900, $lt[4]+1, @lt[3,2,1,0];
my $path=”/var/logs”;

$file=”$path/file-$dte”;
print “$file \n”;

Leave a Reply

Your email address will not be published. Required fields are marked *