--- Scott Lutz <[EMAIL PROTECTED]> wrote: > I am trying to get the date to create a file named after the current > date. > ( running under win32 ) > > here is the code : > my $datestamp=`date`; > print "File name created : $datestamp\n";
'date', on a Windows box, allows you to display or set the date. It defaults to setting the date, so your program gives no output because it's waiting for you to set the date (probably not what you want). 'date /T' should allow you to get the date without waiting for input. Despite that, I wouldn't use backticks here. A system call is too much overhead when this function is built in. my $datestamp = localtime; See 'perldoc -f localtime' for more information about this. I'd probably do this: my ( $day, $month, $year ) = (localtime)[3..5]; $year += 1900; $month++; my $date = sprintf("%4i-%02d-%02d",$year,$month,$day); That will give you a nice, sortable date that fits the ISO-8601 date format. Cheers, Curtis "Ovid" Poe ===== "Ovid" on http://www.perlmonks.org/ Someone asked me how to count to 10 in Perl: push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//; shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]