Dave Adams wrote:
I want to create a variable, to be used for other stuff, using today's date. Can anyone help me with the second last line?
sure :) my $currentdate = '20050721';You don't explain what you are trying to get as most of us can't read your mind or have time to extrapolate from your obscure example what you're trying to do.
Please do a full script/command using strict and warnings ...
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);
print $currentdate; # ie no parens...I assume you want to get what printf is printing into $currenttime, in that case
#!/usr/bin/perl use strict; use warnings; use Time::localtime; my $tm = localtime;my $currenttime = sprintf("The current date is %04d%02d%02d\n",$tm->year+1900,($tm->mon)+1, $tm->mday);
print $currenttime; outputs: The current date is 20050721 perldoc -f sprintf HTH :) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>
