in reply to Parsing File Timestamp?
# read info # and then we are ready to build our filename # unless you are writing binary data, the following should # do the trick. $time = time; $filename="myfile_".$time.".txt"; # (and then just print using $filename)
time will give a machine-readable time in seconds from the epoch. It should be a valid way of doing things until around 2030. Hopefully, by then we won't have computers :)
If the time needs to be readable by a human, you can do something like:
$time = scalar localtime; $time =~ tr/ /_/; #get rid of the spaces; $filename = "myfile-".$time.".txt";
|
|---|