On Jul 21, Dave Adams said:

I want to create a variable, to be used for other stuff, using today's date.

And what do you want it to look like? The YYYYMMDD format you have printing?

use Time::localtime;
my $tm = localtime;
printf("The current date is
%04d%02d%02d\n",$tm->year+1900,($tm->mon)+1, $tm->mday);
my $currentdate = ??????
print ($currentdate);

  my $currentdate = sprintf "%04d%02d%02d", $tm->year+1900, ...;

You want sprintf() instead of print(), if you want to store the formatted string instead of print it.

--
Jeff "japhy" Pinyan         %  How can we ever be the sold short or
RPI Acacia Brother #734     %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %    -- Meister Eckhart

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to