Here is a starting place:
#!perl -w

my ($day, $mon, $year) = (localtime(time))[3..5];  # pull day, mon, year
$year %= 100;                                              # I trim to 2 digits, but 
could add 1900 for 4                                                                  
# digit year
$mon++;                                                    # need to add 1 to 
month(runs 0 to 11)
my $filename = 'origoutput';

my $fileout = $filename . sprintf "%02d%02d%02d", $year, $mon, $day;

printf "filename: %-s\nfileout: %-s\n", $filename, $fileout;
^------- Script ends here

Output:

filename: origoutput
fileout: origoutput020130

Wags ;)


-----Original Message-----
From: Peter Rishko [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 30, 2002 13:39
To: [EMAIL PROTECTED]
Subject: Filenames


Hi,

Could someone please help out with the problem of dynamically changing the 
name of an output file?  I would like to concatenate the date to the name of 
the output file so that each time I run my script, the name of the output 
file is different...Any help would be greatly appreciated.

Thanks.

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to