Re: using perl to print yesterday's date, but with formatting options ?



Purl Gurl wrote:
Purl Gurl wrote:
Tom Van Overbeke wrote:

(snipped)

But the format I need is: 30.10.05

print $Array[3], ".", $Array[4] + 1, ".", $Array[5] + 1900;

print $Array[3], ".", $Array[4] + 1, ".0", $Array[5] - 100;

Somewhat obfuscated but named variables help with clarity in using different formats, as you request.

#!perl

($day, $month, $year) = (localtime(time - 86400)) [3,4,5];

print $day, ".", $month + 1, ".0", $year - 100;

print "\n\n";

print $month + 1, "-", $day, "-", $year + 1900;


Purl Gurl

.